views:

17

answers:

1

this code is used to generate 6 empty boxes on thesame row <% while counter < 6 do%> <%name ="txtwinentry1"+counter.to_s %> <%=password_field "txtwinentry1" ,nil,:size => 2,:class => 'xstyle',:id => name %> <%counter = counter + 1%> <%end%>

this code is used to pass the value of txtwinentry1 (with 6 values) to controller

<%= button_to_remote( "Validate", :update => "winningentry", :url => { :action => "checkrow1" }, :with => "'xid1='+$F('winid1')+'&xrange1='+$F('winrange1')+'&xcount1='+ $F('wincount1') +'&xdesc1='+$F('windesc1')+'&xuser1='+$F('txtuser1')+ '&xwinentry1='+ $F('txtwinentry1')")%>

....given the codes above, no values passed from &xwinentry1='+ $F('txtwinentry1') to the controller.

Any information or suggestion to help me solve the problem will be very much appreciated.

Thank you very much.

A: 

Your code is a little bit complicated to understand and I think there are better ways to do what you're trying to (for example, using the form.serialize that is default to the rails remote_form_for: http://api.rubyonrails.org/classes/ActionView/Helpers/PrototypeHelper.html#M002178).

Any way, I could notice that when you're generating the 6 text boxes, you concatenate "txtwinetry1" with the counter, witch gives you something like "txtwinetry11", "txtwinetry12", ... That means that your supposed to do something like '&xwinentry1='+ $F('txtwinentry11')") in your button_to_remote function.

robertokl
hi..thanks for the quick response. Actually i've already tried to use form.serialize. I was able to display the output in a message box just to check if text_field txtwinentry1 contains values, and it have. My problem was, i cannot passed those values from view to controller. I do not know how to pass the values generated in java script to button_to_remote function. Anyway thank you very for the help. I've done it using orm_remote_tag
leigh