Hello, I''ve 4 radio_buttons dynamically generated : Code : <% @collection.each do |q| %> <p><%= q.value %></p> <%= radio_button q.id.to_s, "choice", "1" %> q.choice1 <%#, :onclick => remote_function(:url => {:action => .....%> q.choice2 <%= radio_button q.id.to_s, "choice", "2"%> <%end%> Everytime the user click on a radio_button, I wan''t to verify that all others are checked and show a link to the next page. But I can''t verify if all my radio_buttons are checked. I can only show the link if only one radio is clicked. Code : [...],:onclick => remote_function(:url => {:action => "next"}) %> ... <div id="next"></div> in the controller Code : def next render :update do |page| page.replace_html "next",link_to("Next",:action =>"next_page") end end thanks -- 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 -~----------~----~----~----~------~----~------~--~---
you could put them all in a remote form and instead of calling the remote_function in onclick submit that form. than you get them all in your controller as params. -- 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 -~----------~----~----~----~------~----~------~--~---
Thorsten Mueller wrote:> you could put them all in a remote form and instead of calling the > remote_function in onclick submit that form. than you get them all in > your controller as params.Can you give me more details plz (a little example of code...) Thanks -- 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 -~----------~----~----~----~------~----~------~--~---
<%= form_remote_for(...) do |f| %> you checkboxes go here like that: <%= f.check_box "col_name_or_whatever", :onchange => "$(''your_form_id'').submit();" %> <% end %> in you controller you get all the form data as with any other form. make sure, every checkbox get''s it''s own name/id -- 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 -~----------~----~----~----~------~----~------~--~---
Thorsten Mueller wrote:> <%= form_remote_for(...) do |f| %> > > you checkboxes go here like that: > <%= f.check_box "col_name_or_whatever", :onchange => > "$(''your_form_id'').submit();" %> > > <% end %> > > in you controller you get all the form data as with any other form. make > sure, every checkbox get''s it''s own name/idI''ve written this code <% remote_form_for :check_boxes, "check_boxes", :url => { :action => "validate"}, :html => { :id => "check_boxes" } do |f| %> <p><%= radio_button q.id.to_s, "choice", "1", :onclick => "$(''check_boxes'').submit();", :current_page => @pager.current_page%> but when I click on the radio_button, I''ve the next error : try { Element.update("next", "\u003Ca href=\"\/questionnaires\/list_questions?page=1\"\u003ENext\u003C\/a\u003E"); } catch (e) { alert(''RJS error:\n\n'' + e.toString()); alert(''Element.update(\"next\", \"\\u003Ca href=\\\"\\/questionnaires\\/list_questions?page=1\\\"\\u003ENext\\u003C\\/a\\u003E\");''); throw e } What does it mean? -- 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 -~----------~----~----~----~------~----~------~--~---
your response: page.replace_html "next",link_to("Next",:action =>"next_page") seems to generate an error (so at least clicking the checkbox seems to submit the form and call the action) as far as i can see, it tries to render the ajax response as normal html or text (was this rendered as content of the page or an actual error message by the browser?) -- 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 -~----------~----~----~----~------~----~------~--~---