Thursday 15 July 2010

ruby on rails - Render partial through link in form_for using jquery ajax -


, I have used multistep in my application

I used to present my partially The link for the form_for the form

My html code is,

  & lt; Div class = "carousel-inner" & gt; & Lt;% = @subscribe for form_ ,: valid = & gt; True ,: html = & gt; {: Id = & gt; "Main_form"}. F | & Gt%; & Lt; Ul class = 'carosel_buttons inline' & gt; & Lt; Li class = 'circle active' & gt; & Lt; H2 & gt; & Lt;% = link_to "1", date_path ,: Remote = & gt; True% & gt; & Lt; / H2 & gt; & Lt; / Li & gt; & Lt; Li class = 'circle' & gt; & Lt; H2 & gt; & Lt;% = link_to "2", booking_path ,: Remote = & gt; True% & gt; & Lt; / H2 & gt; & Lt; / Li & gt; & Lt; / Ul & gt; & Lt; Div class = "item" & gt; & Lt;% = Render "#{@subscribe.current_step}_step" ,: f => F% & gt; & Lt; / Div & gt; & Lt; / Div & gt;   

I want to present partially on the click of "1" using the link_to tag using AJAX.

I now have my controller,

  DEF Definition Answer-to-dot | Format | End of expiry of format.js   

and as of this date js.erb file,

  $ ('. Item'). Html ("& lt;% = Escape_javascript (render 'date_step',: f => f)%>);   

with partial file

  & lt; Div class = "field offset2" id = "date" & gt; & Lt;% = f.label: Date% & gt; & Lt; Br / & gt; & Lt;% = f.hidden_field: start_date,: id = & gt; "Set_start_date"%> & Lt;% = f.hidden_field: end_date ,: id = & gt; "Set_end_date"%> & Lt; Div id = 'datepicker' & gt; & Lt; / Div & gt; & Lt; / Div & gt;   

But when I click on 1,

Undefined local variable or method for ActionView :: Template :: error (# & lt; #) `F '0x007fb87ae09748>): 1: $ (' item '). Html ("& lt;% = escape_javascript (render 'date_step' ,: f => f)%>);

I know because my J. S. B.B. I am unable to link to the file: f = & gt; F ...

Can you please tell me how to do it.

Thank you in advance.

In your HTML you are using the subscription item @ and to pass it, but F Date is not defined on the controller's limit, nor in date.js.erb.

I recommend partially submitting all the forms (together with the assistant for the form) and the controller (in the date function) you can unsubscribe with the membership @new Or find it with parameters (subscribe.Paint [: id])

If this solution does not work for you, tell me!

No comments:

Post a Comment