AnsweredAssumed Answered

onSubmit validation not working with dropdown

Question asked by phinchey on Apr 20, 2016
Latest reply on Apr 22, 2016 by Andy_Thompson

On a basic change approval type task, which has a dropdown of 3 fixed values (Approve, Reject, More info) with underlying data values of (1, 0 , 2) respectively.  There is also a Blank entry that defaults on the form, and even though the field is required, this blank entry is acting as a valid selection

 

I added the following Script and call the function on submit in the form:

{
  onSubmitValidate :  function () {
    var yourValues = ca_pam_getSelectedOptionValues('Form.Status');
    if(yourValues== ' '){
      alert('Status Not Selected');
      return False;
    }
  else{
   return True;
  }
  },
}

 

When I generate a new task, and click complete without changing the Status dropdown selection, I do get the 'Status Not Selected' alert, but then the form continues to complete anyway, which makes it less than useful.

 

Is there some other return I need to pass to actually stop the submit, or some other trick to avoid this issue with dropdown selections?

Outcomes