jquery - extra parameter from dropdown passed to controller for new object creation -
I have an object @ phiman that comes from (I reduce it all, to reduce it ):
@idFiles = params [: file_ids] @phills = file. Find (@ id files) I / O for each @ files Create, but above that, I want to add the user selected option:
@ files.each do | Fc | FileTemp.create (: filename = & gt; fc.name ,: selectedOption => fc.myOption) This is my idea that I have 1 (selected) 'myOption' Each element of the value is @flays:
<% @ files.each do | F | & Gt%; & Lt; Td> & Lt;% = f.name% & gt; & Lt; / Td> & Lt; Td> & Lt;% = f.path% & gt; & Lt; / Td> [...] <% = select_tag f.myOption, options_for_select (f.MultipleOptions.split (";")%> <% end%> But how can I pass my chosen value to my controller, so that to create my new 'FileTemp' object
Many thanks in advance (I have been blocked for weeks. .)
PS. Initially, I update Ajax using that value (without rebuilding another object), but I thought this method would be easy I tried just a simple example to pass an extra parameter through a select_tag.
In my form I just add the select_tag call to the instance
<% = select_tag : Any_name, options_for_select ([1, 2])%> If I'm submitting the form then you pass the parameters in the development log You can see.
Parameter: {... "any_name" => "1", "Product" = & gt; {...}, "Commit" = & gt; "Create a product"} Now I get [[any_name]] in the requested Controller Action.
You should decide what your needs are next check
Comments
Post a Comment