Print Page | Close Window

Validate Specific Fields

Printed From: Foxit's Planet PDF Forum
Category: Lets Talk PDF
Forum Name: JavaScript
Forum Description: Discussions relating to the use of JavaScript within PDF.
Printed Date: 19 Nov 2019 at 4:21pm
Software Version: Web Wiz Forums 11.10 -

Topic: Validate Specific Fields
Posted By: Barra
Subject: Validate Specific Fields
Date Posted: 19 Feb 2014 at 11:44pm
I would like to know how to modify the code below so that I can add specific fields that will be left out of the validatio (eg say a field called 1Dropbox5).

I realise the blue text is probably where that would go, but I have zero scripting experience and someone was kind enough to to send me this script.

Any help would be greatly appreciated. 

function ValueEQDefaultValue() {
   var bResult = false; // assume no errors;
   //If there are, it highlights them with a red border
   for (var i = 0; i < this.numFields; i++) {
    var f =  this.getField(this.getNthFieldName(i));
    var FieldType = f.type; // get field type;
    // test all fields except button and signature;
    if(FieldType !=  "button" && FieldType != "signature" ) {
        f.lineWidth = 0;
        f.strokeColor = color.transparent;
        // see if value has not changed from default value;
        if(f.value == f.defaultValue) {
          // highlight unchanged field
          f.strokeColor =;
          f.lineWidth = 2;
          bResult = true; // report a field not changed;
        } // end value same as default value;
  } // end field type not button or signature;
  if(FieldType == "signature") {
   // enter needed validation here;
   } // end field name loop;
     return bResult; // exit function;
   } // end ValueEQDefaultValue

//Checks to see if there are any unchanged fields;
if( ValueEQDefaultValue() ) {
        app.alert("You must fill in all required fields before submitting.");
} else {
// action that all fields passed;

Print Page | Close Window

Forum Software by Web Wiz Forums® version 11.10 -
Copyright ©2001-2017 Web Wiz Ltd. -