Skip to content

[Form lib] Unexpected handling of validation onSubmit #85383

@jloleysens

Description

@jloleysens

Kibana version:

Current master

Describe the bug:

There is a very specific validation implementation in ILM currently:

export const rolloverThresholdsValidator: ValidationFunc = ({ form }) => {

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 submiting 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Feature:FormLibTeam:Kibana ManagementDev Tools, Index Management, Upgrade Assistant, ILM, Ingest Node Pipelines, and more t//bugFixes for quality problems that affect the customer experience

    Type

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions