[Form lib] Unexpected handling of validation onSubmit #85383
Labels
Feature:FormLib
Team:Kibana Management
Dev Tools, Index Management, Upgrade Assistant, ILM, Ingest Node Pipelines, and more
Kibana version:
Current master
Describe the bug:
There is a very specific validation implementation in ILM currently:
kibana/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/form/validations.ts
Line 59 in 73fbf2a
This validates the value of 3 fields and adds an error depending on that validation to each of the three fields. This implementation creates a situation where submitting the form will cause the form to block submitting because the validator does not return a value on error. Instead, the validator calls "setError" against each of the 3 fields when the error condition is met.
The expectation would be for the form lib to block on these fields with errors, not just checking if running
validate
returned any errors.In other words the expected behaviour is; check if any fields have errors after the most recent validation was triggered. This will be triggered by
submit
ing the form OR if the validator returned any "errors".Any additional context:
PR implementing a work-around #85292 - fix is to have the validator return a value.
The text was updated successfully, but these errors were encountered: