2 Replies Latest reply on Nov 7, 2012 2:15 PM by daltxn

    Get Field and Radio Button in Array

    daltxn

      I have a form containing nine Text Box Fields and four Radio Button groups.  The form opens with all Text Box Fields being empty and the Radio Button groups all being "OFF" (no radio buttons selected).  I have taken the following code, modified it from looking at the ToolTip value and have it look rather at the f.required property.  I'm presently executing this code from a test button on the form but receive the following error:

       

      InvalidGetError: Get not possible, invalid or unknown.

      Field.required:13:Field TEST2:Mouse Up

       

      If I insert a Try/Catch I can suppress that error and the code completes execution.  An alert box is displayed stating that all nine Text Box Fields require a value but it does not count the four radio button groups.  Essentially, I'm expecting the count to return all empty Text Box Fields and all Radio Button groups where a selection has not been made totatling to thirteen fields that require a value.

       

      I'm sure the solution is right under my nose but this is baffling me.  Thank you in advance for any assistance.

       

       

      function validateFields()
      {
      var flg = 0;
      var n = this.numFields;
      var fArr = new Array();
      
      for(var i = 0;i<n;i++){
      var fn = this.getNthFieldName(i);
      var f = this.getField(fn);
      var cReq = f.required;
      var tt = cReq.toString();
      
       if(tt.indexOf('true')!=-1 && f.value == f.defaultValue){
        flg++;
        fArr[fArr.length] = tt;
       }
      }
      
      if(flg>0){
       app.alert('There are '+flg+' fields that require a value\n\n'+ fArr,3)
      }
      else{
       this.print();
      }
      
      }
      validateFields()