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

Bug - Form field change events should be called on every page step. #1119

Open
kevin-hine-innis opened this issue Oct 26, 2021 · 1 comment

Comments

@kevin-hine-innis
Copy link

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.

@kevin-hine-innis 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
@kevin-hine-innis
Copy link
Author

kevin-hine-innis commented Oct 28, 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants