2 Replies Latest reply on Sep 12, 2013 12:14 PM by millerjudi

    Need help with javascript used to check for data in required fields

    millerjudi

      I keep getting a syntax error (SyntaxError: missing : after property id 17; at line 18).  I'm trying to run a script to check for data in all the required radio button fields before letting the user submit the form (or save it).  Here's the code I'm using:

       

      var AllRequiredFieldsSet = true;

      for(var i=0; i<this.numFields;i++)//loop through all form fields

      {

                     var fldName=this.getNthFieldName;

                     var currentFld= this.getField(fldName);

                     if(currentFld.type=="radio")

                     {

                                    //All radios are required so see if user filled them out

                                    if(currentFld.value=="Off")

                                                   AllRequiredFieldsSet = false;//one of the radio buttons has not been selected so form can't be submitted

                     }

      }

      if (AllRequiredFieldsSet==false)

                     app.alert("All required fields have not been completed");

      else

      this.submitForm({cURL "mailto:EMAILADDRESS@gmail.com", cSubmitAs: "PDF"});

       

      I'm not missing any brackets...Any ideas as to what I'm missing?

       

      Thanks! Judy