RailsCasts Pro episodes are now free!

Learn more or hide this

Nikhil Bhavsar's Profile

GitHub User: nik-007

Comments by Nikhil Bhavsar

Avatar

hey friends i got the solution on multi-step form edit and update methods something like this bellow->

after watching this video I created two step form and it was working greatly thanks to Sir Ryan, but after while when i was went for editing and update the form it doesn't working.
It renders on the first step successfully but when i click on the continue button the form goes to update and skips the next step. That was really big issue with my app.

So after very long efforts I found solution may be it is wrong way but for me its working smoothly lets see how it works->

First of all gave the "name: some name" to all buttons n that form's each button.
then make extra view file (not partial) for last step (i had only 2 steps) so for second step as same as your partial for second step.
now then come back to your controller's update method and write code

if params[:continue_button]
   render :template => '/your_controller/second_step_view'
elsif params[:save_button]
  @user.update(user_params)
  respond_with(@user)
else
  render new_user_path  #it will render u on firststep again
end

that's it.

lets

Avatar

yes i found one solution after very long battle to this type of form you can see my comment bellow how i did it.

Avatar

are you able to do edit and update using your code? if yes then please help me to do same. I am stuck at edit and update . whenever I'm trying to edit it showing first step that is okay but after pressing the continue button form saves and not going to next step. what should i do?