Bug with Condition under Simple Validation Rules?


(Jamie Smith) #1

Matrix Version: 5.4.0.1

This concerns a Custom Form. I’m trying to add a Condition under Simple Validation Rules so that a question is only Required if another question, in the previous section, has been answered with a value lower than 2. Not matter the value selected in the first question (e.g. 4), the field on the second page of the form is always marked Required.

I wonder whether this might be a bug. Here’s another question with similar problems that don’t look to have been resolved: Custom Form - Required field only when option in list is selected. I can’t see the fixing of a bug of this nature in subsequent versions of Matrix (http://bit.ly/2tP4i2e). In any case, it would be good to rule out user error on my part!

Cheers.


(Bart Banda) #2

It’s a fairly old version of Matrix now, so perhaps it has been fixed in more recent versions. But I wonder if the required mark gets put in place regardless of that conditional rule?
As in, does the form still submit if you don’t fill out that field when the validation rule is not met?


#3

I tested this, the submission behaviour seems correct (submits if condition not met, doesn’t submit if condition met and value not entered), it just looks like you have to put in a value in both cases, because of the dumb required field indicator.
There’s no on the fly validation so it can’t indicate whether it’s going to be required or not.
You could:

  • Use note field to specify “required if condition
  • and/or Hide required field indicator for that question using css
  • Provide own validation using javascript. I would mark the second question as optional, show/hide the question based on the previous answer, and prevent submission/display error if the conditions aren’t met.

(Jamie Smith) #4

Many thanks for your responses. I think I’ll stick with my own custom JavaScript validation for the moment, but may use the built-in Matrix conditional validation in future.