Expand my Community achievements bar.

Validate fields before signature

Avatar

Level 1

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? 
8 Replies

Avatar

Level 1

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

Avatar

Former Community Member

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.

Avatar

Level 1

Hi Adam,

No, I never figured it out before I had to move onto other stuff. I went

with the double click (the form is meant for a small group so I can do some

human management).

That said, I did get an e-mail from forms@adobe the same day you wrote to me

mentioning a partial solution. Here is the text (including a link)

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.

I have not checked it out, but maybe it can help you. Let me know if it

does. I'll peak at it when I get some time.

Good Luck!!

Gordon

PS: where you writing from? "Hey mate" suggests you might be from "down

under"

Avatar

Level 1

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

Avatar

Former Community Member

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

Avatar

Level 1
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

Avatar

Level 1

When I attempt to use your example code, I receive error on syntax check...

//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";

}

Error: syntax error near token '!' on line 3, column 22

Any ideas why this is? Any help would be greatly appreciated.

Thanks

Avatar

Level 2
  

I tried to use this to solve a related issues where multiple fields must have a minimum value.


What should I do to resolve this?

//if all fields have their target value or greater in them make signature field updatable

//otherwise set it to readOnly

If (ASTM1.rawValue >= 4 & ASTM2.rawValue >= 5 & ASTM3.rawValue >= 6 & ASTM4.rawValue >= 3 & ASTM5.rawValue >= 2 & ASTM6.rawValue >= 8 & ASTM9.rawValue >= 1 & ASTM10.rawValue >= 3 & ASTM11.rawValue >= 1 & ASTM12.rawValue >= 0) {

this.access = "open";

} else {

this.access = "readOnly";

}

Error: syntax error near token "{" line 5, column 227