Forum
How do I display a dedicated error message, if string fails to validate
Hi Forum,
I am validating a form field against a specific string as described here:
https://forum.grabaperch.com/forum/07-15-2014-form-submit-required-validation-not-working?page=1#reply-21652
(Forget about my post in that thread. I figured it out.)
The only problem left is:
How do I display an error message, if the input string does not match the one to compare with?
For now I use
<perch:error for="all" type="general">[Error message here.]</perch:error>
But it would be nice to have a message appear besides the input field.
I am running Perch 2.8.8 and use the Forms app.
Instead of
for="all"
usefor="fieldID"
to show errors for a specific field.I tried
and
and both do not appear when an incorrect string is entered. The form just doesn't get sent.
Validation works, though, as when I enter the correct string the form sends perfectly.
What type of validation are you performing? Can you show us the input tag?
The input field looks like this:
The helper function looks like this:
Ok, you're using a validation helper. So you should be able to use:
Worked like a charm.
Thank you, Drew.