Hi all, How can i use form_remote_tag inside the form_tag helper . My application has following view subscribe.html.haml - form_tag :action => :subscribe do /other form element %input{:type=>''radio'', :name=>''tariff_plan_id'', :value=>"monthly"} %input{:type=>''radio'', :name=>''tariff_plan_id'', :value=>"yearly"} - form_remote_tag(:update => "result_discount_code", :url => { :action => :discount_code }, :position => "top" ) do =text_field ''discount_code'' =submit_tag ''Apply Discount'' #result_discount_code =submit_tag ''Subscribe'' Can I use form_remote_tag inside the form_tag? When user hit ''Apply Discount'' button i will perform following steps get the value of radio button "tariff_plan_id" and from this value get the value from "discount_code" textbox. perform some operations on these value and result is show in "result_discount_code" div. There are two radio buttons. so user can select one of them see what discount he will get. Is this a right way to doing this? Thanks , Vikas -- Posted via http://www.ruby-forum.com/.
Frederick Cheung
2009-Sep-17 12:24 UTC
Re: Can i use "form_remote_tag" inside the "form_tag"?
On 17 Sep 2009, at 13:21, Vikas Gholap wrote:> > Hi all, > > How can i use form_remote_tag inside the form_tag helper . >forms cannot be nested. I imagine you could skip the second form and wire up the ajax request straight to a button. Fred> My application has following view subscribe.html.haml > > - form_tag :action => :subscribe do > > /other form element > %input{:type=>''radio'', :name=>''tariff_plan_id'', :value=>"monthly"} > %input{:type=>''radio'', :name=>''tariff_plan_id'', :value=>"yearly"} > > > > - form_remote_tag(:update => "result_discount_code", :url => > { :action > => :discount_code }, :position => "top" ) do > > =text_field ''discount_code'' > =submit_tag ''Apply Discount'' > > #result_discount_code > > > > =submit_tag ''Subscribe'' > > > Can I use form_remote_tag inside the form_tag? > > > When user hit ''Apply Discount'' button i will perform following steps > > get the value of radio button "tariff_plan_id" and from this value > get the value from "discount_code" textbox. > > perform some operations on these value and > result is show in "result_discount_code" div. > > There are two radio buttons. so user can select one of them see what > discount he will get. > > Is this a right way to doing this? > > Thanks , > Vikas > -- > 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 > -~----------~----~----~----~------~----~------~--~--- >
Abhijat Mahajan
2009-Sep-18 03:56 UTC
Re: Can i use "form_remote_tag" inside the "form_tag"?
Hi Forms can not be nested Browsers handle form focus, index fields(tab behavior) return behavior and those are reasonable concerns not to do that. If you want to be able to achieve what you mentioned there, using rails prototype helpers obeserve_field is a suggestion you can apply that to any other JS library you might be using. Thanks Abhijat On Sep 17, 10:21 pm, Vikas Gholap <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> Hi all, > > How can i use form_remote_tag inside the form_tag helper . > > My application has following view subscribe.html.haml > > - form_tag :action => :subscribe do > > /other form element > %input{:type=>''radio'', :name=>''tariff_plan_id'', :value=>"monthly"} > %input{:type=>''radio'', :name=>''tariff_plan_id'', :value=>"yearly"} > > - form_remote_tag(:update => "result_discount_code", :url => { :action > => :discount_code }, :position => "top" ) do > > =text_field ''discount_code'' > =submit_tag ''Apply Discount'' > > #result_discount_code > > =submit_tag ''Subscribe'' > > Can I use form_remote_tag inside the form_tag? > > When user hit ''Apply Discount'' button i will perform following steps > > get the value of radio button "tariff_plan_id" and from this value > get the value from "discount_code" textbox. > > perform some operations on these value and > result is show in "result_discount_code" div. > > There are two radio buttons. so user can select one of them see what > discount he will get. > > Is this a right way to doing this? > > Thanks , > Vikas > -- > Posted viahttp://www.ruby-forum.com/.