You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When you have a multi-page/step form, all pages and fields are visible by default (by visible, I mean not marked as hidden [you can't see them, but the steps still exist in the progress bar]). It is not until a user interacts with the form that the visibility of conditionally displayed pages/steps change.
For example:
Imagine a multi-page/step form with checkbox on page 1.
Now lets say page 2 should be hidden if the checkbox is checked.
If the default state of the checkbox is unchecked, then the form works as expected (page 2 shows unless the user checks the box).
However, if the default state of that checkbox is checked, then the form does not work as expected (if the user simply clicks next, page 2 will show).
This is because the module hides page 2 using the onChange javascript event. So, unless the state of the checkbox changes, page 2 will always show up.
To work around this, I am currently triggering the onChange event to fire on page load and every time a page changes.
I am only triggering the change events for fields on the current step (which is important).
I can create a pull request for this if this makes sense to everyone else.
The text was updated successfully, but these errors were encountered:
kevin-hine-innis
changed the title
Form field change events should be called on every page step.
Bug - Form field change events should be called on every page step.
Oct 26, 2021
This is not entirely true...
Commit 79259b5 addresses this by setting the form step visibility on page load, but it does not address everything.
So, for example, I created 2 pages.
Page 1 has a checkbox defaulted to checked.
Page 2 has its initial visibility set to hide, and a rule to show it if the checkbox is checked.
So in this example, page two is unavailable (page two doesn't show in the progress bar, and the next button doesn't do anything when clicked) until the user unchecks the box.
This simple example doesn't make a tone of sense (just set the initial visibility of page 2 to show), but it illustrates a larger problem.
When you have a multi-page/step form, all pages and fields are visible by default (by visible, I mean not marked as hidden [you can't see them, but the steps still exist in the progress bar]). It is not until a user interacts with the form that the visibility of conditionally displayed pages/steps change.
For example:
Imagine a multi-page/step form with checkbox on page 1.
Now lets say page 2 should be hidden if the checkbox is checked.
If the default state of the checkbox is unchecked, then the form works as expected (page 2 shows unless the user checks the box).
However, if the default state of that checkbox is checked, then the form does not work as expected (if the user simply clicks next, page 2 will show).
This is because the module hides page 2 using the onChange javascript event. So, unless the state of the checkbox changes, page 2 will always show up.
To work around this, I am currently triggering the onChange event to fire on page load and every time a page changes.
I am only triggering the change events for fields on the current step (which is important).
I can create a pull request for this if this makes sense to everyone else.
The text was updated successfully, but these errors were encountered: