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

FIO-9360: validate current page only on wizard change #5920

Merged
merged 4 commits into from
Nov 25, 2024
Merged

Conversation

brendanbond
Copy link
Contributor

@brendanbond brendanbond commented Nov 21, 2024

Link to Jira Ticket

https://formio.atlassian.net/browse/FIO-9360

Description

This PR reverts:

to consolidate validation of Wizard components into one simple rule: on change, only validate and show the current page's validation errors unless you've already attempted to submit the form.

Breaking Changes / Backwards Compatibility

Technically this is a breaking change - previously, the renderer would validate all components (much like it does with forms) and selectively display them based on the UI's context. However, this proves to be tricky with nested forms, and it's easiest to just only validate the currently displayed components when it comes to wizards.

Dependencies

n/a

How has this PR been tested?

All tests pass. Added a few automated tests to ensure that Wizards will only validate currently displayed components.

Checklist:

  • I have completed the above PR template
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation (if applicable)
  • My changes generate no new warnings
  • My changes include tests that prove my fix is effective (or that my feature works as intended)
  • New and existing unit/integration tests pass locally with my changes
  • Any dependent changes have corresponding PRs that are listed above

@travist
Copy link
Member

travist commented Nov 22, 2024

👍

- this.validate() is only called in onChange() if the form previously failed to submit. Because of this, the form will already be dirty, so it makes sense to reiterate this by passing dirty: true instead of false.
@lane-formio lane-formio merged commit c9a1f36 into master Nov 25, 2024
5 checks passed
lane-formio pushed a commit that referenced this pull request Nov 26, 2024
* validate current page on wizard change

* add tests

* fix tests

* Specify correct flag for form validation after failed wizard submission

- this.validate() is only called in onChange() if the form previously failed to submit. Because of this, the form will already be dirty, so it makes sense to reiterate this by passing dirty: true instead of false.

---------

Co-authored-by: Blake Krammes <[email protected]>
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

Successfully merging this pull request may close these issues.

4 participants