开发者

Retrieve all options from select tag after submitting

I have a slight problem with getting the options within the select tag. Some background information; This is a report, and as such the select options will vary depending on what is stored on the DB depending on some conditions. So, I'm using observe field to get the selected option, BUT, I need to get all the 开发者_C百科options because I want render that same report with a) the selected option that was chosen the first time and the remaining ones.

select "price", "desc", @desc, {:prompt => 'All'}

I'm obviously observing the field, to display the result, so the variable @desc is the hash with the all the values.

Can you help me get hash to be sent to the controller, and how can I have the selected option selected in the hash to be sent back to the view....

Cheers


You have the options already, so where'd you get them? Are they report specific? If so, send the report_id back so you can look all of them up again, then you can select the selected one.

You can't (easily) get all of the options in a select list. Technically, you could write a javascript function that would grab all of them and send them as parameters. Or, you could write them out as a hidden field and submit that with the request, but both of those ways are ugly.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜