Skip to main content
Participant
March 30, 2023
質問

Button to allow data entry

  • March 30, 2023
  • 返信数 2.
  • 1593 ビュー

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

このトピックへの返信は締め切られました。

返信数 2

JR Boulay
Community Expert
Community Expert
April 4, 2023

Une image vaut mieux qu'un long discours :

 

Acrobate du PDF, InDesigner et Photoshopographe
Participant
April 4, 2023

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;

}

}

BarlaeDC
Community Expert
Community Expert
April 14, 2023

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.

BarlaeDC
Community Expert
Community Expert
March 31, 2023

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.

Participant
April 3, 2023

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.