Best approach for multi step form?
Answered
Scarlet Tanager posted this in #help-forum
Scarlet TanagerOP
Should I create new route for each step of form for example I have 4 steps form should we create 4 routes or render the whole 4 multi step form in one route?
11 Replies
@Scarlet Tanager Should I create new route for each step of form for example I have 4 steps form should we create 4 routes or render the whole 4 multi step form in one route?
if I would be you, I would check my use case and where and how the data be saved. If it's for example a database and you have a table like "start questions" and each questions can have many answers, I would do that (route approach). But if it's like a database and you have one user object and there a keys for something like "role", I would do it via a clientside multi step form
@B33fb0n3 if I would be you, I would check my use case and where and how the data be saved. If it's for example a database and you have a table like "start questions" and each questions can have many answers, I would do that (route approach). But if it's like a database and you have one user object and there a keys for something like "role", I would do it via a clientside multi step form
Scarlet TanagerOP
I have external backend in php and client in nextjs when we fill each step all that data for that step needs to be saved because if user leaves the page and come back the data needs to be there not to be filled over again
... that step needs to be saved ...Then you can do it with the route approach, but keep in mind to have a clean redirect flow then. If you don't know how, you can still use a clientform
@B33fb0n3 > ... that step needs to be saved ...
Then you can do it with the route approach, but keep in mind to have a clean redirect flow then. If you don't know how, you can still use a clientform
Scarlet TanagerOP
I need to create a shared layout for these 4 routes to look like spa
@B33fb0n3 if I would be you, I would check my use case and where and how the data be saved. If it's for example a database and you have a table like "start questions" and each questions can have many answers, I would do that (route approach). But if it's like a database and you have one user object and there a keys for something like "role", I would do it via a clientside multi step form
Scarlet TanagerOP
All that questions in multistep form will be for a user so all that data would be applied to that user that is filling it but first he needs to register and then start to fill multistep
@Scarlet Tanager All that questions in multistep form will be for a user so all that data would be applied to that user that is filling it but first he needs to register and then start to fill multistep
yea, then you can still follow one of these approaches: https://nextjs-forum.com/post/1243855136376361042#message-1243882342221611132
@Scarlet Tanager solved?
Scarlet TanagerOP
I didn’t try yet
@Scarlet Tanager I didn’t try yet
American Crow
i did a proof of concept for a muli step multi route form recently. If you need the code i could separate it out in a repo. Let me know