GentleForm icon indicating copy to clipboard operation
GentleForm copied to clipboard

How to manually trigger an error?

Open badpenguin opened this issue 7 years ago • 2 comments

I want to do additional checkes when the form isValid, i.e. like when validating a multiple checkbox list. Is there a way to trigger an error and have the error box appear?

badpenguin avatar Dec 06 '17 17:12 badpenguin

There is currently no way to add custom validators. The only supported ones are the ones from the HTML5 specification.

But your suggestion makes total sense and I'm willing to add that to the API. I'll need to think about it a bit, perhaps there's a way to add validators to the HTML5 API. In any case, I'll need to think about validation: when and how it should happen for custom validators.

zhouzi avatar Dec 07 '17 09:12 zhouzi

@Zhouzi actually the scenario is when you have field that depend on other field's value or, as in may use case, when you have multiple checkboxes and at least 1 must be checked.

badpenguin avatar Dec 07 '17 13:12 badpenguin