Taylor Strait
2009-Jan-21 03:09 UTC
tricky issue - AJAX + form text fields + sortable_list
I have a custom form builder that has a question type of "rank order." That is where you rank the choices in order from 1-5, or whatever. So I have the answer choices set up as a sortable list that has a text field with the order position. Using AJAX, I can change the order of these answers AND update the text fields with the proper numerical rank. The problem is that when the form is POST submitted, it does not use the AJAX-updated values in the text fields but the original values from the page load DESPITE the text fields being different. If I manually change the field by typing, it POSTs correctly. How can I force the form to grab the "fresh" values from the text fields on submittal? Thanks in advance! -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Mark Reginald James
2009-Jan-22 01:08 UTC
Re: tricky issue - AJAX + form text fields + sortable_list
Taylor Strait wrote:> I have a custom form builder that has a question type of "rank order." > That is where you rank the choices in order from 1-5, or whatever. So I > have the answer choices set up as a sortable list that has a text field > with the order position. Using AJAX, I can change the order of these > answers AND update the text fields with the proper numerical rank. > > The problem is that when the form is POST submitted, it does not use the > AJAX-updated values in the text fields but the original values from the > page load DESPITE the text fields being different. If I manually change > the field by typing, it POSTs correctly. How can I force the form to > grab the "fresh" values from the text fields on submittal?What browser are you using, what code are you using to set the field contents, and what version of Prototype are you using? -- Rails Wheels - Find Plugins, List & Sell Plugins - http://railswheels.com --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Taylor Strait
2009-Jan-22 01:20 UTC
Re: tricky issue - AJAX + form text fields + sortable_list
Mark Reginald James wrote:> Taylor Strait wrote: >> grab the "fresh" values from the text fields on submittal? > What browser are you using, what code are you using to set the > field contents, and what version of Prototype are you using?I had tested this on FF3. I went back with Safari to test it and it was working. So I went back with FF3 and it is ALSO working. Perhaps the bugfix was a side effect of some code changes today. Thanks for responding! As far as my methodology, I have Answers with variable "position." On the ajax update, I build a new list of text_fields with ''value = @answer.position.'' This allows both drag and drop and manual sorting with no code changes. The sortable_list java will silently fail on non-java browsers and the user can just fill in the text boxes as they wish. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---