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-7528: Revert FIO-4405: fixed an issue where walidation error displays with empty value even if it is not required (#4746) #5398

Conversation

lane-formio
Copy link
Contributor

This reverts commit 3a8d7d6.

Link to Jira Ticket

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

Description

There is a "shouldSkipValidation" function that checks for, among other things, whether or not the following conditions are satisfied:

(A) there is a custom validation

(B) the dataValue of the component is truthy

(C) the component is required

if A && !B && !C, the component will skip validating. In this case, since the value of an un-blurred select component is "", it is falsy and satisfies A && !B && !C. I'm not sure why this was introduced (I imagine to ensure that empty values that aren't required don't get validated) but we may need to reexamine our thinking behind this. In the meantime, the only workaround I can think of is to both set the field to required and maintain the custom validation, so both are ensured to run.

Here's the line in question:

() => this.component.validate.custom && !this.dataValue && !this.component.validate.required,

from this commit: formio.js: //github FIO-4405: fixed an issue where walidation error displays with empty value even if it is not required

Checklist:

  • 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

… empty value even if it is not required (#4746)"

This reverts commit 3a8d7d6.
@travist travist merged commit c650422 into master Nov 7, 2023
@lane-formio lane-formio changed the title Revert FIO-4405: fixed an issue where walidation error displays with empty value even if it is not required (#4746) FIO-7528: Revert FIO-4405: fixed an issue where walidation error displays with empty value even if it is not required (#4746) Nov 7, 2023
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.

2 participants