# Way to get the form name/id from a form\_for (default) builder?

**URL:** <https://www.ruby-forum.com/t/way-to-get-the-form-name-id-from-a-form-for-default-builder/133053>\
**Category:** Rails\
**Created:** [March 27, 2008, 6:57am UTC](https://www.ruby-forum.com/t/way-to-get-the-form-name-id-from-a-form-for-default-builder/133053 "2008-03-27T06:57:14Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![madcap](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/f475e1/32.png) [@madcap](https://www.ruby-forum.com/u/madcap)\
**Post date:** [March 27, 2008, 6:57am UTC](https://www.ruby-forum.com/t/way-to-get-the-form-name-id-from-a-form-for-default-builder/133053/1 "2008-03-27T06:57:14Z")

</div>

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, … %\>  
Press Me\</  
button\>  
\<%= form.select(:rights, … %\>  
\<% end %\>

Thanks in advance!
