Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get next step from form data #25

Open
smohadjer opened this issue Jul 26, 2018 · 3 comments
Open

Get next step from form data #25

smohadjer opened this issue Jul 26, 2018 · 3 comments
Assignees

Comments

@smohadjer
Copy link
Owner

smohadjer commented Jul 26, 2018

I don't like this line:

$nextStep = 'form.php?step=' . ($step + 1);

Imagine you have a form with ten steps and then you want to add a step between 2nd and 3rd. The easiest way would be to call it step 2.5, otherwise if you want to call it step 3 it means you have to rename all existing steps and form action inside them and other things that depend on step number, incrementing them all by one. Lots of work with possibility of breaking things. Why don't we simply get the next step a form should direct to from a hidden field inside that step? Wouldn't it make steps more modular and changes easier?

<input type="hidden" name="nextstep" value="3" />

@smohadjer
Copy link
Owner Author

If you agree, let me know and I will make the change.

@smohadjer
Copy link
Owner Author

smohadjer commented Jul 26, 2018

I went ahead and made the change in a new branch here: 0361e68

I think this can also help us with implementing sub-steps. However we still need to fix the code for navigation to support this. I suggest that instead of a "TOTAL_STEPS" variable we use an array like this:

STEPS = [1, 2, 2.5, 3, 4];

Then we can loop through this array to generate markup for navigation links. Do you agree?

@smohadjer
Copy link
Owner Author

smohadjer commented Jul 26, 2018

I implemented that and opened a pull request for you. #26

@smohadjer smohadjer changed the title Get next step from from data Get next step from form data Jul 26, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants