0

I'm building a wizard form with wicked gem. Basically, i need to add two button on one form page. Wicked gem suggests we can use link_to, but link_to doesn't save the form. and then we wrote a javascript function for link_to so that clicking button will submit, but the problem was the two buttons both redirect to the next same step instead of the steps we specified.

Now we find this link saying using button_to would work. Here comes the problem,

first, here's our code,

 %td
   =button_to "Add Task", project_wizard_path(@project, :add_task), :class => "btn btn-primary"
 %td
   =button_to "Proceed To Budget", project_wizard_path(@project, :budget_estimates), :class => "btn btn-primary"

it is fine for the "add task" button, but for the second buttion, it goes to the url "projects/project_name/wizard/budget_estimates" and says routing error.

This link suggests we should add method: :get, and yes it does work but it doesn't save the form and also the url will be with all the parameters if data is saved. So i also tried to add method: :put, it skips the budge_estimates and goes to the next step after budget_estimates.

So what would be problem? the request Post and Get should be almost same i suppose and they are supposed to submit the form, right?

need some help here! :) :o

Community
  • 1
  • 1
user2775888
  • 39
  • 10
  • Can you add your controller code and routes? Then we can see how you've set up your wizard. – Tom Kadwill Sep 17 '14 at 06:15
  • Thanks for your reply! but we ended up checking params[:commit] in the update action of wizard controller by using f.submit "Proceed to Budget", which we should've thought about! – user2775888 Sep 17 '14 at 06:38

0 Answers0