Dom id on form_remote_tag


#1

I want to make use of a form_remote_tag to submit a form
asynchronously. Easy done. However, we also want to add an
observe_form tag to check for some value changes while the form is
being entered.

The observe_form tag needs a dom id to work on but I can’t see how to
enter an html option for the dom id of the form on the
form_remote_tag.

Any ideas?

Here is the form tag so far…

<%=form_remote_tag :loading=>“showProgress()”,
:complete=>“showForm()”,:url=>{:action=>:new,
:controller=>“sample_controller”}, :update=>“sampleForm”%>


#2

Use

<%=form_remote_tag :loading=>“showProgress()”,
:complete=>“showForm()”,:url=>{:action=>:new,
:controller=>“sample_controller”}, :update=>“sampleForm”,
:html => {:id => ‘your-super-cool-id’}%>

Last line is where it’s different

Hope this helps!
Daniel


#3

Excellent - that did the trick. Thanks for your help - the whole area
of html options is not well-documented on the api page, the fact that
it says html_options and not html is misleading for starters.

Thanks again

Sean