Skip navigation
kiefferg
Currently Being Moderated

Validate fields before signature

Dec 30, 2010 7:24 AM

Hello --- hope you are all enjoying the holiday season.


I'm working on a fillable pdf form for my office mates to use as a cover sheet for certifying invoices for payment. I have a few fields which must be filled in for the finance team to accept the document. I also have a document signature field so the form filler can sign the coversheet (our office has certificates all set up). I'm using LiveCycle Designer (LCD) on an enterprise so I have no control over when/if I'll ever have a later version. The one I have is whatever comes with Acrobat 8.x (pertinant becasue it does not have preSign and postSign events with signature fields).

 

I'm trying to have the form check that the required fields are non-empty before the document is signed and prevent a signature on an incomplete form. I was envisioning an appropriate little script in some event on the signature field. Should be easy, right? Well, I wouldn't be posting if I'd succeded

 

The solutions I've tried are listed below. They each fall short --- maybe some one can help make one of them work, or maybe some one has a different approach that will work. I'm all ears. I'm happy to admit that some good old RTFM may be involved, but I'd appreciate a pointer to which FM to RT. I have experience coding (mostly in C/Perl) but am pretty green with java.

 

Thanks for you time !!

 

Gordon

 

  • Mark the fields as required in the Object value tab: This sort of worked. When I left a required field empty and then signed the document, I got a warning message about empty fields. But the signature process flow continued and signed the document. I was left with a signature that would be invalid because I'd need to go back and fill in the missing data. I played with the "Validation Pattern" and "Validation Script" options in the value tab but had no luck. Did I miss something simple there?

 

  • Scirpt in a signature event: I played with little validating scripts in the click and mouseDown events of the signature field. I could get them to check for null in the required fields, but I could not then stop the signature process flow. Any ideas?

 

  • Fake Signature Button: I borrowed an idea from a post on this forum in which some one suggested putting a "fake print button" over an invisible but real print button (in that case the designer wanted to prevent printing of an incomplete document). The "fake button" called an appropriate script to check for empty fields in its click event and then "clicked" the real (and invisible) print button via RealPrintButton.execEvent("click"). I've now lost the post so I can't credit its author -- sorry -- but it seemed like a great idea! I covered my signature field with a button and tried the following code in the click event:

 

          form1.#subform[0].button::click - (JavaScript, client)


     if( RequiredTextField.rawValue != null ) {

          // reveal the obsecured sig field by making the button invisible

          button_subform.presence = "invisible";

          // fire off the digital signature

          SignatureField.execEvent("click");

     }

     else

     {

          // keep hiding access to the signature field

          xfa.host.messageBox("Please fill in all required fields");

     }

 

          It didn't work. I later found a post in which some one said that the  digital signature process flow is complicated and that a genuine user  click is not the same as a click from javascript. Presumably it work for the button case.

 

  • Fake Signature Button 2: Do the "button over the signature" thing as above but don't try to "click" the signature for the user -- force the user to manually click the signature field once it has been revealed. I see two drawbacks to this approach. Firstly, I shoudn't have to give in on this -- there has to be a way to do what I want. Secondly, how long will it be before some user whines about having to click twice to sign a document? 
 
Replies
  • Currently Being Moderated
    Apr 18, 2011 2:12 AM   in reply to kiefferg

    Hey mate,

     

    Did you find a solution to your problem? Or did you have to go with the double click option in the end?

    I am using LCD ES2 and am keen to ensure that a drop down list and date field are non-empty before signing is allowed (pretty similar to your case) but have not had any success. Doesn't look like a standard signature field will allow these sort of actions in the pre-sign event?

     

    Cheers,

     

    Adam

     
    |
    Mark as:
  • Currently Being Moderated
    Apr 18, 2011 4:04 AM   in reply to kiefferg

    I've put a bit of a solution to this at

     

    http://users.cecs.anu.edu.au/~gmcintyr/example.xdp.zip

     

    based on something I saw a few years ago. The form has 3 account fields. Leave one or all of them empty, click on Submit and it will give you a message and then, add them to an error list. In a bigger application, like the ones I work on, I'd add other types of validations to the list.

     
    |
    Mark as:
  • Currently Being Moderated
    Apr 21, 2011 2:01 AM   in reply to kiefferg

    Thanks for replying Gordon,

     

    You've correctly guessed my location =P, I'm writing from Western Australia.

     

    In the example you attached It appears that only buttons have been used

    (i.e. no signature fields) however some of the code or the approach may

    still be useful - I have only been able to have a quick look myself at this

    point (have been out of the office lately).

     

    Our form is also intended for a fairly small group and so I may also go with

    the double click option.

    I'll let you know how it works out.

     

    Thanks again,

     

    Adam

     
    |
    Mark as:
  • Currently Being Moderated
    Apr 21, 2011 2:21 AM   in reply to kiefferg

    Hi Adam,

     

    Just re-read your requirements and realised I would do it different from the original question. I would make the signature field read only until something is entered in the mandatory fields.

     

    You could do it this way. In the signature field's Initialize and Calculate events, I would add the following scirpt

     

    //if both fields have something in them make signature field updatable

    //otherwise set it to readOnly

    If ((field1.rawValue != "" && field1.rawValue != null) && field2.rawValue != "" & field2.rawValue != null) {

         this.access = "open";

    } else {

         this.access = "readOnly";

    }

     

     

    Gordon

     
    |
    Mark as:
  • Currently Being Moderated
    May 16, 2011 4:29 AM   in reply to fbook
    Hi Gordon,
    Thanks for your quick replies and apologies for my very delayed  response to your latest suggestion. I headed off on holiday for a couple  of weeks over Easter (and a bit more). I saw your new post when I got back but with a few other new things  to get sorted as a priority I am only just now catching up with where I left off =/.

     

    Anyway...enough excuses.
    I have gone with your latest suggestion to make the signature field read only until the required fields are filled.
    In the end I input the code in the Initialize event (as you said)  and the enter event. Using the Calculate event worked however I got the following  message: "The value you entered for PLEASE SIGN cannot  override its calculated value". Maybe there is another way around this  but It seemed that using the enter event instead worked well without  this message so I went for that.

     

    Thanks again for all your help mate.
    Very much appreciated,

    Adam

     
    |
    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