4 Replies Latest reply on Mar 15, 2016 2:20 AM by ryand54430413

    Submit button checking multiple dropdowns are not the default

    ryand54430413

      Hi All,

       

      I am creating a form which has multiple dropdowns and I am adding a submit button which checks on Mouseup runs the following code. I need it so that they are not still on the default value and they have selected something different otherwise it will not submit.

       

      For instance field "UserDepartment" has the default value of "Select Department:" I have added the checked for 3 of the dropdowns so far but no matter what I pick it always goes through and doesn't pop up with an alert even if the default is chosen.

       

      What am I doing wrong? I have read multiple other questions but to me (inexperienced) it looks fine.

       

       

      var v = this.getField("UserDepartment").value;
      var v2 = this.getField("UserRole").value;
      var v3 = this.getField("ManagerRole").value;
      if (v == "Select Department:")
      {
          app.alert("You must select a valid department for the new starter before you can submit this form.");
      }
      else if (v2 == "Select Job Role:")
      {
          app.alert("You must select a valid department for the new starter before you can submit this form.");
      }
      else if (v3 == "Select Job Role:")
      {
          app.alert("You must select a valid department for the manager before you can submit this form.");
      }
      else
      {
          submitForm({cURL: "mailto:test1233323@gmail.com", cSubmitAs: "PDF"});
      }