CalcBuilder Forum

How to validate option lists?

User moon_1411 2014-01-15 06:20:43

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 2014-01-15 10:27:52

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 2014-01-16 11:37:00

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

...
Support/development

Perfect for small code changes or to correct any bug at your site

Buy now!
...
Support/development 10 hours

Get a bigger amount of hours for more complex tasks and get a 10% discount

Buy now!