Showing different partials containing forms via surface controller, upon completion of each form, show next form partial
Is this something that would be possible?
I'm looking to present the user with a form, and upon completion of this form, in my controller im trying to then swap the first form out, with a new form, and repeat this process X times.
Reason being I have X number of separate forms, but they are to be filled in all in one go, I just thought it would be nice if I could swap them out without reloading the page.
Does anyone have any advice for this or a method for showing/hiding/injecting/deleting those partials on success in my controller?
Just an fyi Kieron, the returned value is html, so you can just update the html of the div that contains the currently viewed form, with the new html (make sure to store your form data somewhere though e.g. in session, local storage, cookie etc)
Showing different partials containing forms via surface controller, upon completion of each form, show next form partial
Is this something that would be possible?
I'm looking to present the user with a form, and upon completion of this form, in my controller im trying to then swap the first form out, with a new form, and repeat this process X times.
Reason being I have X number of separate forms, but they are to be filled in all in one go, I just thought it would be nice if I could swap them out without reloading the page.
Does anyone have any advice for this or a method for showing/hiding/injecting/deleting those partials on success in my controller?
Thanks!
Yes this is possible. I did something similar. I used ajax calls to a SurfaceController. My controller looks like this.
My javascript looks like this:
You can do your own magic in the controller with the form data, return a new form and change it using javascript/jQuery.
Hope this example helps!
Just an fyi Kieron, the returned value is html, so you can just update the html of the div that contains the currently viewed form, with the new html (make sure to store your form data somewhere though e.g. in session, local storage, cookie etc)
is working on a reply...