2 Replies Latest reply on Dec 24, 2015 2:56 AM by Shekharmine

    PRINT is no working.. help me please

    Shekharmine Level 1

      I have a form with 8 text fields.

      in that 8 fields 3 fields are required.

      and a print button also there.

      i wrote the following code to print button.

      when i click on print while required fields are empty..

      it showing required fields are empty, please fill them. it is ok,

      but when i fill all required fields and press PRINT, nothing happens.. i want the form should be print.

      please look ate this code and correct it.

      (i wrote code for

      if required fields are empty, then show error.

      but didn't write for PRINT if require fields filled).

      here is the code

       

      var emptyFields = [];

      for (var i=0; i<this.numFields; i++) {

           var f= this.getField(this.getNthFieldName(i));

           if (f.type!="button" && f.required ) {

                if ((f.type=="text" && f.value=="") || (f.type=="checkbox" && f.value=="Off")) emptyFields.push(f.name);

           }

      }

      if (emptyFields.length>0) {

           app.alert("Error! You must fill in the following fields:\n" + emptyFields.join("\n"));

      }