Can i use "form_remote_tag" inside the "form_tag"?

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

On 17 Sep 2009, at 13:21, Vikas G. 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

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 G. [email protected]

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs