Chris Lowis
2006-Aug-12 17:30 UTC
[Ferret-talk] How to add # anchor to ferret generated url ?
I have the following action in my controller
def search
@query = params[:query] || ''''
unless @query.blank?
@results = Residence.find_by_contents @query
end
end
In my View I have
<div id="search-box">
<%= form_tag( { :action => ''search''}, :method =>
''get'')%>
<input type="text" id="search-text"
name="query" value="<%= h @query
%>" />
<%= submit_tag ''search'' %>
<%= end_form_tag %>
</div>
<% if @results -%>
<a name="results"></a>
...
<% end %>
When the user clicks "search" the generated url is eg:
http://localhost:3000/?query=10013&commit=search
How would I append a #results to this url so that the browser window
"jumps" to the result output part of the page ? I apologise if this is
not a ferret-specific question.
Thank you for your help,
Chris
--
Posted via http://www.ruby-forum.com/.
Jens Kraemer
2006-Aug-13 11:10 UTC
[Ferret-talk] How to add # anchor to ferret generated url ?
Hi! On Sat, Aug 12, 2006 at 07:30:35PM +0200, Chris Lowis wrote: [..]> In my View I have > > <div id="search-box"> > <%= form_tag( { :action => ''search''}, :method => ''get'')%>[..]> How would I append a #results to this url so that the browser window > "jumps" to the result output part of the page ? I apologise if this is > not a ferret-specific question.try <%= form_tag( { :action => ''search'', :anchor => ''results'' }, :method => ''get'')%> Jens -- webit! Gesellschaft f?r neue Medien mbH www.webit.de Dipl.-Wirtschaftsingenieur Jens Kr?mer kraemer at webit.de Schnorrstra?e 76 Tel +49 351 46766 0 D-01069 Dresden Fax +49 351 46766 66
Chris Lowis
2006-Aug-15 12:24 UTC
[Ferret-talk] How to add # anchor to ferret generated url ?
> try > > <%= form_tag( { :action => ''search'', :anchor => ''results'' }, :method => > ''get'')%> >Thank you Jens ! I should have checked the form_tag documentation. Appreciate your help, Chris -- Posted via http://www.ruby-forum.com/.