Skip to content

Why there is check for validity.valid if all rules came true? #40

@matej116

Description

@matej116

There is check for validity.valid if elem.type === 'number' in the end of validateControl() function, which 1) has untranslatable error message and 2) is causing unexpected errors if there is condition rule and another rule after it.

More explanation for 2):

  • create input of type number

  • call ->addRule(Form::MIN, 0)

  • call ->addConditionOn( , )->setRequired();

  • call ->addRule(Form::MAX, 10)

  • let the form render, fill value bigger than 10

  • with this setup, the element has set both min and max properties, rendering validity.valid to be false for some value > 10. Calling validateControl() in this case would cause recursive call (because of the condition beeing true) and the condition for validity.valid in the end of nested call validateControl() fails.

Please corrrect me if I am wrong, but I am seeing the check for validity.valid useless.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    Triage: Next

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions