Expand my Community achievements bar.

Making the fields readonly after signing the form

Avatar

Former Community Member
Hello,



I would like to add some script to the layout:ready event of the signature field to make all the fields readonly that are visible on the form.

But unfortunately after signing no layout:ready event is fired.



How can I achieve the running of the mentioned event ?

What I do now is:

At 'change':

set a variable according to the state of the signature field

At 'layout:ready'

make the fields readonly / open according to the variable

But as I mentioned there is no layout:ready event.

(After any further modification on the page the event fires and set the access of the fields correctly, but of course the signature is also broken)



I also tried to set all the fields readOnly/open at 'change' event.

But I could not reach the fields defined on the master pages and the fields on the subforms contained by Referenced Objects

Is there any way to do that ?



And perhaps there is a 3. simplier (working) way that I do not know...

If there is, please write it down.



Thanks in advance,

Ferenc
3 Replies

Avatar

Former Community Member
You won't get a layout:ready event when a signature is signed because the layout is not recalculated (the layout doesn't change). Using the change event is the better way to go. To access fields from your script that are not contained in the same parent as the sig field you need to use fully qualified SOM expressions. For a field in a body page it would like something like this:



xfa.form.formName.pageName.subformName.fieldName



and for a field in the master page it would look something like:



xfa.form.formName.pageSet.masterPageName.fieldName



Chris

Adobe Enterprise Developer Support

Avatar

Former Community Member
Hi Chris,



Sorry about late response.

Unfortunatelly any modification in the change event or later seeems to be too late (it brokes the signature)



Now what I use:

- set fields to readonly in the mouseDown event

- set fields to open in the change/click event if the signature field is empty/cleared



Problems with it:

- It does not work when someone right-click on the signatrie field

and select "Sign Signature Field...". The only event generated is 'change', but as I mentioned it seems to be too late.

Q: Is there any event that is executed right before the signing process initiated from context menu?

When is the exact time of starting signing process (between which events) ?



- If I use left-click to initiate signing process ON A STATIC FORM form it works almost fine (signature is OK, fields become readonly), but if I add a button field to show the 'access' of a field in a messagebox it returns 'open' after closing and reopening the signed documents, but the field itself is not editable.

Q: Why is it?



- If I generate the same form as a DYNAMIC one, after left-clicking and signing the form the signature is broken. It seems that the script in the 'mouseDown' event runs after the signing in this case and this make the signature field broken. The fields are READONLY after signing, but the save icon also become active showing that something is changed.

a. If I NOT SAVE the doc again and reopen the one saved during signing I can see that the fields are open.

b. If I SAVE the doc again, close and reopen the doc, the fields are open.

Q: Why become the signature field broken in case of a dynamic form when it almost work perfect in case of a static one ?

Q: Regarding b. If I save a form where all the fields are readonly, how could it happen that when I reopen the pdf the field are editable ??? What is saved than ???

(After reopening both the pdfs of case a. and b., the only different is that at b. the signature field is broken.)



Adobe Reader version 7.0.7

The forms were generated by ADS integrated with SAP Netweaver platform.



Best regards,

Ferenc

Avatar

Former Community Member
Firstly, let's clarify that the signature is not broken, it simply reflects the fact that there was a change in the form (the fields are changed to readOnly).



> Q: Is there any event that is executed right before the signing process initiated from context menu?



No. Typically you wouldn't do this as the act of signing the document protects against changes. The sig tells you that a change has occured and lets you review the changes.



>When is the exact time of starting signing process (between which

> events) ?



Somewhere between click and change I guess.



> but if I add a button field to show the 'access' of a field in a

> messagebox it returns 'open' after closing and reopening the signed > documents, but the field itself is not editable.

> Q: Why is it?



Looks like a bug, but at least it is actually readOnly. I'll look into that further and log it if need be.



> Q: Why become the signature field broken in case of a dynamic form

> when it almost work perfect in case of a static one ?



I'm not sure, the internal working of dynamic forms can be complicated. But I see it work sometimes and not others.



> Regarding b. If I save a form where all the fields are readonly, how > could it happen that when I reopen the pdf the field are editable

> ??? What is saved than ???



This is normal for dynamic forms. Because of the dynamic nature of dynamic PDF's the form is rebuilt from the template and the data everytime it is opened. In the template the fields are not readOnly so they aren't readOnly when you reopen it. You'd have to have a script run at the begining to set the fields to readOnly to have that persist. Of course the sig would detect that and reflect it.



For now my recommendation would be either don't do this, and let the sig do the work. Or if your not using anything that requires a dynamic PDF then use a static one since it's simpler implementation seems to lend better to doing this type of thing.



Chris

Adobe Enterprise Developer Support