Lock certain form fields after digital signature


#1

Hello,
I use the PDF Architect 5 Pro version
In this version, it is possible to create form fields and embed JavaScript.
Unfortunately, I cannot lock certain fields after a digital signature.
According to Internet, it is possible to define in the properties of a signature field, which form fields to be blocked after signing a certain signature field.
(Info: In order to create a signature field in PDF Architect, you have to go for a detour. The document has to be signed with the appropriate tool. After that, the signature can be deleted via the context menu. The size and properties can then be edited using the Edit function.)
Specifically, I have a form, into which certain data are to be entered by several persons. By signing this part of the process is then completed. After the signature, the fields of this part should be no longer editable.
How can I manage this problem with PDF Architect.
I have not been able to use JavaScript in a form field to check whether a specific signature has been set.
Otherwise, it might be possible.
Thanks for your help in advance.


#2

Hi,

I think JavaScript will be the only way to do this in PDF Architect.
In the Adobe Forum, the following code was mentioned:
var oSigState = event.target.getField(“form1[0].#subform[0].SignatureField1[0]”).signatureInfo().status;
if (oSigState == 0) {
app.alert(“The Signature is missing”);
}
Perhaps something like the above in combination with this.getField(“Text1”).readonly = true; could do the trick.

Best regards,

Robin


#3

Hello,
First of all, thank you for your help.
I have now found several solution.
The solutions all work only by way of detours.
However, these do not work in PDFArchitect.
Although it is possible to write the code in PDFArchitect, the code in PDFArchitect does not run when filling a form.
In the “Adobe Acrobat Reader DC” runs the code.
I would even say that a lot of the code can be written in “PDFArchitect” then later only in the “Adobe Acrobat Reader” run.
I also have made the experience that it is useful to create an additional field for global functions.
This then can be made write-protected and invisible.

Again background information:
The document is more like a list.
Every point of the list has two text fields, a checkbox and a signature field.
This four Fields of one point have the names “Vers1” (text field), “Note1” (text field), “Finished1” (checkbox), “Signature1” (signature field). The number of the point are incremental.
The checkbox is necessary because after signing, no code can be triggered independently.
When starting to fill the form the text fields and the checkbox are enabled and the signature field is disabled.
If the checkbox is checked, the text fields are disable and the signature field is enable.
If the checkbox is unchecked, the text fields are enable and the signature field is disable.
If the signature field is signed, the checkbox can not be unchecked.
If the signature is deleted again, the checkbox can be unchecked again.
The function will be activated when a checkbox is switched.

Shortest solution:
Checkbox code of checkbox “Finished1”:
checkSign(1);

Global code:
function checkSign (WorkstepNumber)
{
/* Get access to fields */
var fieldVers = this.getField(“Vers” + WorkstepNumber);
var fieldNote = this.getField(“Note” + WorkstepNumber);
var fieldFinished = this.getField(“Finished” + WorkstepNumber);
var fieldSig = this.getField(“Signature” + WorkstepNumber);

/* Check Signature */
if ( fieldSig.value != “” )
{
fieldFinished.value = “Yes”;
}

/* Check “finished checkboxes” */
if (fieldFinished.value == “Off”)
{
fieldVers.readonly = false;
fieldNote.readonly = false;
fieldSig.readonly = true;
}
else
{
fieldVers.readonly = true;
fieldNote.readonly = true;
fieldSig.readonly = false;
}
}

Little longer solution:
Checkbox code of checkbox “Finished1”:
checkSign(1);

Global code:
function checkSign (WorkstepNumber)
{
/* Get access to fields */
var fieldVers = this.getField(“Vers” + WorkstepNumber);
var fieldNote = this.getField(“Note” + WorkstepNumber);
var fieldFinished = this.getField(“Finished” + WorkstepNumber);
var fieldSig = this.getField(“Signature” + WorkstepNumber);
var status = fieldSig.signatureValidate();
var sigInfo = fieldSig.signatureInfo();

/* Check Signature */
if ( status != 0 )
{
fieldFinished.value = “Yes”;
}

/* Check “finished checkboxes” */
if (fieldFinished.value == “Off”)
{
fieldVers.readonly = false;
fieldNote.readonly = false;
fieldSig.readonly = true;
}
else
{
fieldVers.readonly = true;
fieldNote.readonly = true;
fieldSig.readonly = false;
}
}


#4

Hi,

thank you for the detailed feedback.
I think the problem is PDF Architect doesn’t seem to be able to have/evaluate any global code, where did you enter this?
“I also have made the experience that it is useful to create an additional field for global functions.”
How does the code of the checkbox “finished1” know where to find the checkSign function if it is assigned to an additional field? Does ist actually call something like additionalField.checkSign?
Sorry for all the questions, JavaScript for PDF isn’t really my territory.

Best regards,

Robin


#5

Hello,

For me the programming in Javascript and pdf forms is also new.
I try and sometimes it works.
But I also gladly help if it is possible for me.
The functions are automatically found or executed.
There is no explicit reference required.
You should only pay attention to declare a function only once.

Have a nice day.

Matthias Gabel