# :index option for form select

**URL:** <https://www.ruby-forum.com/t/index-option-for-form-select/142828>\
**Category:** Rails\
**Created:** [July 11, 2008, 9:26pm UTC](https://www.ruby-forum.com/t/index-option-for-form-select/142828 "2008-07-11T21:26:14Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![markmt](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/df705f/32.png) [@markmt](https://www.ruby-forum.com/u/markmt)\
**Post date:** [July 11, 2008, 9:26pm UTC](https://www.ruby-forum.com/t/index-option-for-form-select/142828/1 "2008-07-11T21:26:14Z")

</div>

I’ve found the :index option to be useful and necessary for form  
methods when I have a form that contains fields for multiple records,  
some of which have already been saved previously and some of which are  
new.

However I ran into a problem today when I was trying to do this with a  
form that had a pull down select field for each of several records -  
the :index just wasn’t being inserted into the params hash. After much  
frustration and investigation I finally found the explanation in the  
api documentation ([http://api.rubyonrails.org/classes/ActionView/](http://api.rubyonrails.org/classes/ActionView/)  
Helpers/FormOptionsHelper.html) -

"Like the other form helpers, select can accept an :index option to  
manually set the ID used in the resulting output. Unlike other  
helpers, select expects this option to be in the html\_options  
parameter. "

This explains exactly why I was having trouble and the problem is now  
fixed. But it leaves me with a big question… why??? Why on earth  
would they put this option in a different method parameter? Is there  
some logic behind this?
