Skip navigation
mj276
Currently Being Moderated

Help with JavaScript validation of signatures based upon a form dollar amount

Apr 9, 2012 10:41 AM

Tags: #javascript #validation #signatures #mutliple

Greetings,

First, I have no experience with JavaScript. 

 

I have a PDF Form (Adobe Acrobat X Pro) with a dollar amount.  Based upon that dollar amount a certain signature (text box) must be completed.  Upon the mouse down action for the Save Form button, I need to validate that there is an entry for the correct signature (again, based upon the dollar amount).

 

My weak pseudo code for this would be:

 

If (dollarAmount > 0) and (dollarAmount < 100) and (signature1 == "") then printToScreen ("Requires Signature1")

else if (dollarAmount > 101) and (dollarAmount < 200) and (signature2 == "") then printToScreen ("Requires Signature2")

else if (dollarAmount > 201) and (signature3 == "") then printToScreen ("Requires Signature3")

 

Any and all help would be appreciated.  Thank you.

 
Replies
  • Currently Being Moderated
    Apr 9, 2012 12:48 PM   in reply to mj276

    This script will do what you describe in your pseudo-code, but be aware it's not handling the following situations:

    - dollarAmount is empty

    - dollarAmount is exactly 100

    - dollarAmount is exactly 200

     

    var dollar = +this.getField("dollarAmount").value;

    var signature1 = this.getField("signature1").value;

    var signature2 = this.getField("signature2").value;

    var signature3 = this.getField("signature3").value;

     

    if (dollar>0 && dollar<100)

        if (signature1=="") {

            app.alert("Requires Signature1");

        }

    } else if (dollar>101 && dollar<200) {

        if (signature2=="") {

            app.alert("Requires Signature2");

        }

    } else if (dollar>201) {

        if (signature3=="") {

            app.alert("Requires Signature3");

        }

    }

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points