Hi list, I'm writing a little survey application, and surveys are generated dynamically. I use form_remote_tag and AJAX to submit the form to a method 'submit' in my 'survey' controller. The view generates the form as: <tr> <td>Question 1?</td> <td><input id="resultset_1" name="resultset" size="30" type="text" /></td> </tr> <tr> <td>Question 2?</td> <td><input id="resultset_2" name="resultset" size="30" type="text" /></td> </tr> etc... How can I access the array/object 'resultset' in my submit action in the survey controller? I've tried using @resultset in the 'submit' view or params[:resultset] in the 'submit' action, both seem to be nil. Hope someone can help me. Thanks in advance!
on 2005-12-29 18:11
on 2005-12-29 18:26
params[:resultset] is what you want. Try using params[:resultset] ['1'] instead of params[:resultset]. (notice the number 1 in quotes) ~ ryan ~
on 2005-12-29 18:42
2005/12/29, Michiel Sikkes <email@example.com>: > </tr> > > Hope someone can help me. > > Thanks in advance! Ah, I think I know what the problem is. I should have some resultset defined in the 'show' method for the view first. But text_field etc. work with @object.method, and not with for example @array[id]. Is there any way of doing the latter thing? TIA