madcap
2008-Mar-27 05:56 UTC
Way to get the form name/id from a form_for (default) builder?
Hi all,
I''d like to be able to refer to a form being created by form_for from
javascript. To do this, I''d like to know what will be the id and/or
name that''s going to be set on the form. I understand I can override
the id or name, but i''d prefer not to.
For instance, I''m looking for something to fill in
someMethodToGiveMeInputNameFor:
<% form_for :role, ... %>
<button type="button"
onClick="doSomething(document.getElementById(''<
%= form.someMethodToGiveMeInputNameFor(:rights) %>'')">Press
Me</
button>
<%= form.select(:rights, ... %>
<% end %>
Thanks in advance!
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---