Skip to main content
CalcBuilder logo
CalcBuilder Forum

How to validate option lists?

User moon_1411

The validation script doesn't work on my option list fields (I have selected "Required" in the field configuration). I have set a first option without any value with the name "--- Select ---", but when I look into the generated code, there is still a value associated with this option but the "mv_option" is empty, so I guess that the script should look first if the mv_option has a value, and if not, display an error message, but it doesn't seems to be working that way. Do I have to write an extra script in the JavaScript section? If so, could you give me the code to write?

Thank you!

Moonsoft support

Hello,

Option List is special for required validation. You should add to 'Css class' in your field in backend: cb_option_non_first
This generates a validate error if first option is selected. If you want to change message, you should change 'OPTION_REQUIRED' property in language fields.

Hope this helps. Regards,

User moon_1411

Ok I will try that!! :)
Thank you very much!

...
Support/development 40 hours

With the peace of mind of having a professional team at your service (20% discount)

Buy now!
...
CalcBuilder

Create dynamic calculators

Buy now!