Forum: Ruby on Rails Reset and Retain data in Text Fields on RoR Forms

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
F7868264da954faaa158256820e7fa74?d=identicon&s=25 Niaz Arifin (arif)
on 2007-07-21 00:24
I apologize if this appears to be too elementary and answered before.
I need to reset a text_field (named as 'server_name') in my controller.
The relevant controller code is:
  <%= start_form_tag :action => 'search'%>
    <%= text_field :server, :server_name, :size => 15 %>
    <%= submit_tag 'Search' %>
  <%= end_form_tag %>

Also, I need to retain the values typed by the user in the above text
Could anybody help on how to do these?
Thanks in advance.
581905e940c1e30190108a0c5c0b915b?d=identicon&s=25 Adam Cohen (Guest)
on 2007-07-21 00:39
(Received via mailing list)
1) don't use start_form_tag and end_form_tag -> they've been
deprecated.  Use form_tag  or form_for instead.

2) when/how do you want to reset the text field? Do you want to have a
button that the user can press to reset the text field?  If so, you
can use javascript to do this..

3) what do you mean "retain the values"? Retain them where? Store them
to a database?  Keep the values in the text fields if the user submits
a form with errors?  Please elaborate.

This topic is locked and can not be replied to.