Topic: Reset form fields after they have changed with a remote_function
Hello, i have a form with some text fields and a radio button with two options. One of the two options when chosen causes some other text fields to be addede to the form by a remote_function call.
Here's the code:
<%= start_form_tag :action=>'edit_rule', :id=>@rule.id %>
<%= text_field 'rule', 'opt', { :style => 'width: 100%;' } %>
<%= text_field 'rule', 'par', { :style => 'width: 100%;' } %>
<%= radio_button_tag 'opt_notifications_type', 'default', true, :onclick => remote_function(:update => "custom_notifications",
:url => { :action => :show_custom_notifications, :id => 'default' }) %><label for="opt_notifications_type">Default</label><br/>
<%= radio_button_tag 'opt_notifications_type', 'custom', false, :onclick => remote_function(:update => "custom_notifications",
:url => { :action => :show_custom_notifications, :id => 'custom' }) %><label for="opt_notifications_type">Custom</label>
<div id="custom_notifications">
</div>
<input type="submit" value="Save">
<input type="reset" value="Reset">
<% end_form_tag %>
The problem is that if i click the reset button every text_field is reset in the correct way.
Even the radio button reset itself, however if the div was modified by a remote_function call it doesn't reset itself.
Is there a way to force the reset to some element modified by a remote_function call?
Thanks in advance for the help.
Last edited by stratio (2011-10-21 11:35:51)