Skip to content

A clean way to attach error messages to form fields? #466

Closed Answered by jtdaugherty
amano-kenji asked this question in Q&A
Discussion options

You must be logged in to vote

The built-in form is not designed to specifically allow for presenting validation errors when the per-field validators fail. Validation states are expressed using form attributes. If you want to display your own validation errors, I suspect you’ll need to subvert the built-in validation machinery and just store the validation errors as part of the field values themselves, which you can then have control over rendering. So, for example, instead of having a value of type a in your form state, have a value of type Either ValidationError a. That’ll require you to also update your form state in EventM after you’ve run your own validators.

Replies: 1 comment 8 replies

Comment options

You must be logged in to vote
8 replies
@jtdaugherty
Comment options

Answer selected by amano-kenji
@amano-kenji
Comment options

@jtdaugherty
Comment options

@amano-kenji
Comment options

@amano-kenji
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants