Select Option in form


(Nmathew) #1

Hi;

 

I have a select field,i need that field to be a required field and dont want to submit the form without having the select from the drop down.

But the form proceeds even tho this is not selected.

 

can you advice how to make this required field


(Nic Hubbard) #2

This is for a Custom Form? Did you make sure to make the question required?


(Bart Banda) #3

You need to set the "Allow empty option" to "No". However that will select the first option in the list by default.

 

On recent matrix version (I tested on 4.16.0), you can add a new rule called regular expression. When adding this, you can add a reg exp rule to make sure that the value submitted for this select field is not empty, whilst having the default value as empty, making it still requried.

 

Even better, in version 4.16.2, they have now added the ability to be able to add empty option, but not allow empty option to be selected, which is the ideal feature: http://manuals.matrix.squizsuite.net/custom-form/chapters/select-question-type

 

Hope that helps.