Issues with Select Box default value/mandatory attribute

craigzeleznick
Kilo Contributor

I currently have a select box and for the default value I have it as "-- Please Select --" but I also need this field to be mandatory field. When testing the red asterisk is there but if the field is left blank and the person submits the form anyway it still allows them to submit without filling in the mandatory fields.

Can someone point me in the right direction on how to fix this issue?

1 ACCEPTED SOLUTION

Hey Craig,



you can add an onSubmit client script:




function onSubmit() {  


  //Type appropriate comment here, and begin script below  


  var v = g_form.getValue('select');//the name of your field  


  if(v == '-- Please Select --') {  


  alert('You must choose an option in the select field');  


  return false;  


  }  


}



NOTE -


In place of "--Please Select --" put the value of that choice.


View solution in original post

17 REPLIES 17

No use this


var v = g_form.getValue('Name of that Question');


I have done this and it still does not make the user fill in the question. All it does is highlight the variable on the form for a half second then lets the user submit.



Thank you,



Craig Zeleznick


Remove the Asterisk Sign That means Remove MANDATORY then it will work.


Because you are making Mandatory through onSubmit Script.