Planet PDF Forum Planet PDF Forum
  New Posts New Posts RSS Feed - Validate Specific Fields
  FAQ FAQ  Forum Search   Register Register  Login Login


Hi, welcome to the Foxit Planet PDF Forum. If you have PDF or Adobe Acrobat questions then the right place to ask them is here, in this forum.

Validate Specific Fields

 Post Reply Post Reply
Author
Barra View Drop Down
New Member
New Member
Avatar

Joined: 19 Feb 2014
Location: Australia
Points: 3
Post Options Post Options   Quote Barra Quote  Post ReplyReply Direct Link To This Post Topic: Validate Specific Fields
    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 = color.red;
          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;
}

Back to Top
Sponsored Links


Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

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

This page was generated in 0.031 seconds.