i have 2 <div> blocks, each which have a select box inside a form. I have an observe_field watching the first dropdown, and populating data from the second one when the first changes. The issue is when i change the first dropdown, the second form element doesnt get submitted any more after clicking on the submit button, and doesnt appear in the "@params" hash any longer. Any idea why this would happen? The data all looks correct in the html form page, even after changing dropdown options, just the field (os_versions) seems to "disappear" after submitting the whole form, and only when changing the OS select box. If i dont change the first dropdown and submit the form, i get all the form values.. here is my snippet: <div align="left" class="addnode_item"> <select name="os" id="os" > <% @systems.each do |s| %> <option value="<%= s.id %>"> <%= s.osname %> </option> <% end %> </select> </div> <%= observe_field "os", :url => {:action => "get_os_versions"}, :update => "os_versions", :with => "''os='' + escape(value)" ,:loading => "os_versions.innerHTML=''<font color=green> Please wait while finding OS versions....</font><br><br>''"%> <div align="left" class="addnode_item" id="os_versions"> <% if @os_id %> <%= render_component(:action => "get_os_versions", :params => { "os" => "#{@os_id}" }) %> <% end %> </div> thanks adam
Hey man Yeah, I had to deal with observe_form last week. It only worked once I put the observe_form tag inside the div that was updated. In other words, the observe_form only worked with one update. If I had any other ajax calls updating the page, they had to update that observe_form as well. Julian. On 04/11/2005, at 2:25 AM, Adam Denenberg wrote:> i have 2 <div> blocks, each which have a select box inside a > form. I have an observe_field watching the first dropdown, and > populating data from the second one when the first changes. The > issue is when i change the first dropdown, the second form element > doesnt get submitted any more after clicking on the submit button, > and doesnt appear in the "@params" hash any longer. Any idea why > this would happen? The data all looks correct in the html form > page, even after changing dropdown options, just the field > (os_versions) seems to "disappear" after submitting the whole form, > and only when changing the OS select box. If i dont change the > first dropdown and submit the form, i get all the form values.. > > here is my snippet: > > <div align="left" class="addnode_item"> > <select name="os" id="os" > > <% @systems.each do |s| %> > <option value="<%= s.id %>"> <%= s.osname %> </option> > <% end %> > </select> > </div> > > <%= observe_field "os", :url => {:action => > "get_os_versions"}, :update => "os_versions", :with => "''os='' + > escape(value)" ,:loading => "os_versions.innerHTML=''<font > color=green> Please wait while finding OS versions....</ > font><br><br>''"%> > > <div align="left" class="addnode_item" id="os_versions"> > <% if @os_id %> > <%= render_component(:action => "get_os_versions", :params > => { "os" => "#{@os_id}" }) %> > <% end %> > </div> > > > thanks > adam > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >
hmm, i am actually using observe_field, not observe_form. observe_field is checking for the "onchange" in a select box and then rendering a partial which is essentially a second select box based on the data in the first. The issue is whenever i change the data in the first select box, observe_field kicks off, updates the second select box, but when submitting hte form, the id is missing from @params, and i cant figure out why. If i dont change the first select box and just submit it gets sent thru fine. Really wierd.. i tried moving the observe_field around, but observe_field is doing what it is supposed to do so not sure what else the problem could be. adam Julian Leviston wrote:> Hey man > > Yeah, I had to deal with observe_form last week. It only worked once I > put the observe_form tag inside the div that was updated. > In other words, the observe_form only worked with one update. If I had > any other ajax calls updating the page, they had to update that > observe_form as well. > > Julian. > > On 04/11/2005, at 2:25 AM, Adam Denenberg wrote: > >> i have 2 <div> blocks, each which have a select box inside a form. >> I have an observe_field watching the first dropdown, and populating >> data from the second one when the first changes. The issue is when i >> change the first dropdown, the second form element doesnt get >> submitted any more after clicking on the submit button, and doesnt >> appear in the "@params" hash any longer. Any idea why this would >> happen? The data all looks correct in the html form page, even >> after changing dropdown options, just the field (os_versions) seems >> to "disappear" after submitting the whole form, and only when >> changing the OS select box. If i dont change the first dropdown and >> submit the form, i get all the form values.. >> >> here is my snippet: >> >> <div align="left" class="addnode_item"> >> <select name="os" id="os" > >> <% @systems.each do |s| %> >> <option value="<%= s.id %>"> <%= s.osname %> </option> >> <% end %> >> </select> >> </div> >> >> <%= observe_field "os", :url => {:action => "get_os_versions"}, >> :update => "os_versions", :with => "''os='' + escape(value)" ,:loading >> => "os_versions.innerHTML=''<font color=green> Please wait while >> finding OS versions....</ font><br><br>''"%> >> >> <div align="left" class="addnode_item" id="os_versions"> >> <% if @os_id %> >> <%= render_component(:action => "get_os_versions", :params => >> { "os" => "#{@os_id}" }) %> >> <% end %> >> </div> >> >> >> thanks >> adam >> _______________________________________________ >> Rails mailing list >> Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >> http://lists.rubyonrails.org/mailman/listinfo/rails >> > > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails