Have the reset button call a javascript function
[ onclick=''yourFunction()'' ] that copies the values into
hidden fields
(for example) then call form.reset at the end if your function.
On Jul 23, 3:00 pm, Arif
<niazari...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:> I have a form with a text_field in one of my views in RAILS. I need
> to:
>
> 1. put a ''reset'' button so that I can clear (set to
blank) the
> text_field when the user clicks on the button
>
> and
>
> 2. retain value in text_field: I have a ''search'' button
that performs
> search (not Ajax livesearch... it''s a simple search and I wrote
the
> code in my controller). Now, when the user puts some text (query) in
> the text_field and clicks on ''search'', the results are
shown ok, but I
> need to retain the text in the text-field that the user put in. Also I
> need to set the focus to this text_field after the results are shown.
>
> The relevant code in the view is:
> <%= start_form_tag :action => ''search''%>
> <%= text_field :server, :server_name, :size => 15 %>
> <%= submit_tag ''Search'' %>
> <%= end_form_tag %>
> <%= set_focus_to_id ''server_server_name'' %>
>
> Any help would be greatly appreciated. Thanks,
> Arif
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Spinoffs" group.
To post to this group, send email to
rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---