Error message from field on a manual location? #1884
-
Is there currently a way for field errors to have a manual/custom position somewhere in the template? Question and use-case Is there a neat way to move the message/error-position to another location (without changing templates)? Idea |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
It's probably not a good idea to include validation on a hidden field for this reason, as the error message won't be seen. There's not really a way to move an error message at the moment. What Formie version are you on? Client-side validation varies between Formie 2 and 3. I'm not a massive fan of introducing another field just for the error message of another field, sorry! Even if this were a summary of all errors for the form, I'm not quite sure how useful it'll be for most people. I can certainly see the benefits here in this case, but that's nothing a custom field couldn't achieve (you could have the field loop through |
Beta Was this translation helpful? Give feedback.
Gotcha, makes sense!
The client-side validator (bouncer.js) doesn't have a collection of errors. But are you calling that validation on-demand like:
or similar? If so, this returns the invalid fields. Anything more than that and we'd need to alter the validator behaviour to accommodate for this. In Formie 3
validator.getErrors()
is possible.Using
submission.getErrors()
is only going to work in Twig, which isn't going to be applicable here for your use case.You almost don't need a custom field - you could use another Hidden field, or even a cosmetic field (Heading, Section, etc) and just include JS to render conten…