Copy link to clipboard
Copied
Hello Everyone,
I'm trying to figure out how to have a button run a JavaScript to check that a signature block is signed before allowing any other data to be input into the fillable form. Basically I am wanting to have some one Sign on the top of the form that will allow for data entry throughout the rest of the form.
Thanks
Copy link to clipboard
Copied
Hi,
That is a bit of an odd workflow, normally we would make fields read only after a signature field is signed. but the signature field has a property -
Which may be able to be used to check the signature using the return values
Then you could change the status of the fields they are supposed to fill in.
Copy link to clipboard
Copied
Yes it is a bit odd. The purpose of it is to have qaulity be our first signature to make the document ready for the floor. Then I'm looking to have a check for my people on the floor to click and it will make sure quality signed the doc before they proceed.
Copy link to clipboard
Copied
Une image vaut mieux qu'un long discours :
Copy link to clipboard
Copied
This is the code I'm runing but it's picking up the entire doc. Not sure how to point it to that one block.
var emptyFields = [];
for (var i=0; i<this.numFields; i++) {
var f = this.getField(this.getNthFieldName(i));
if (f!=null && f.type!="button" && f.required && f.valueAsString==f.defaultValue) {
emptyFields.push(f.name);
}
}
if (emptyFields.length>0) {
app.alert("You must fill in the following fields:\n" + emptyFields.join("\n"));
} else {
for (var i=0; i<this.numFields; i++) {
var f = this.getField(this.getNthFieldName(i));
if (f!=null) f.readonly = true;
}
}
Copy link to clipboard
Copied
Hi,
a PDF form doesn't really have sections from a programitic point of view, they may be ordered in sections for the user, but they are just form fields to the program, are you wanting to limit to the check you have created to certain fields then the easiet way would be to name them in a manner that you know which section they are in.
then in your code you could add something to check it is a field from the area you want, for example if you had fields named:
firstname, lastname, city, dateofbirth
thatn you wanted filled in for the first signature you could change the name to
sig1.firstname, sig1.lastname, sig1.city, sig1.dateofbirth
then you could add a simple check into your if statement
if ( f.indexOf("sig1") != 0) // this would mean that sig1 has been found.
Hope this helps.
Copy link to clipboard
Copied
Yes that helped. I ended up using this:
if (getField("QA_Sig").value !== '') // Means the signature is present
{
app.alert("You have a QA Stamp",3);
}
else
{
app.alert("You don't have a QA Stamp");
}