Hi, I want to add/set a class to a form field when there is a validation error. Is there a keyword i can use in the 'extras' of the form question so when the validation detects an error it notes it in the form field which I can then set styles onto?
Keyword to indicate an error on a form question
quimby
(Tim Davison)
#2
Not anywhere I can test so this is just guesswork...
Could you use %question_error_123_q1^notempty:my-class%? Not sure if you put that into the extras field whether it would be processed or not.
Failing that, you could apply it directly to a parent container should work. But this would require manually coding the Page Contents bodycopy. E.g.
<div class="form-question %question_error_33000_q2^notempty:error-class"> %question_field_33000_q2% </div><!-- /.form-question -->
Then you could target the input as a child of the .form-question.error-class rule. Note these require later versions on Matrix, that support the question_error keyword.