Skip to main content
Participant
November 26, 2021
Question

Lock image fields with signature

  • November 26, 2021
  • 1 reply
  • 617 views

Hi All,

Im currently trying to set up a PDF form where the users can insert screenshots and then sign the form. It works very well with the prepare form -> add an image field tool. If I understand correctly, this creates just a form field with the JavaScript command event.target.buttonImportIcon(). Unfortunately, I cannot find a way to lock the images trough signature. Does anybody know if there is a solution to this? Signature action -> lock all fields does not work, I still can replace the images after. If it does not work by signature, maybe there is a way that the javascript can only be run once to prevent changing the image later.
Many thanks in advance for any thoughts on this

This topic has been closed for replies.

1 reply

try67
Community Expert
Community Expert
November 26, 2021

It's probably because the image of a button field is not really a value, technically speaking.

However, under the Signed event of the signature field you can set the fields as read-only, which will prevent the user from editing them.

 

The code to do so is the following:

 

for (var i=0; i<this.numFields; i++) {
	var fname = this.getNthFieldName(i);
	var f = this.getField(fname);
	if (f==null) continue;
	f.readonly = true;
}

 

Participant
November 27, 2021

Hi,

thank you very much for your quick reply. Unfortunately, this locks all fields, but the image fields still work. I now added an if statement to check that the signature field has not been signed before executing the java command to update the field icon. This works pretty good so far:

 

if (getField("Signature1").value == "")
{event.target.buttonImportIcon();}


Best regards,

Tobias

try67
Community Expert
Community Expert
November 27, 2021

That's not possible. If the field is set as read-only clicking it will do nothing.

But your solution works too!