0

I am using the Wicked gem for multi-step forms and i plan on implementing a custom ajax method, so I will not be able to use the render_wizard method. Right now I am just trying to manually move to the next step. The following does not work:

def update
    jump_to next_step
    render step
end

I've also tried:

def update
    render next_step
end

but the step never actually changes. So just putting "render next_step" keeps on calling the same step because "step" never changes

How do i manually move to the next step?

Philip7899
  • 4,599
  • 4
  • 55
  • 114
  • I would really have liked to know how to do this as I am having the same issue, wicked does not seem to be set up to work with ajax js.erb remote true very well. – Ricky Sep 02 '20 at 15:24
  • I found a solution that worked for me. In the `form_with` that I am rendering I just specify the step like this `url: wicked_step(:my_step)` that way when the form gets reloaded by the js.erb file the partial can tell the form what step to submit to and then the controller just uses that step. – Ricky Sep 02 '20 at 18:12

1 Answers1

-1

Use a .js.erb view to respond to the AJAX command and then in the view, run the render_wizard in there:

$('#content').html('<%= j render_wizard @object %>');
Kevin Bende
  • 157
  • 2
  • 9