Copy link to clipboard
Copied
Hi All,
With a button click I am making my form read only and attaching it to an email.
The only thing is I want to be able to hide all of the JavaScript buttons on the page.
I am aware of the this way to hide buttons:
this.getField("Email_Button").display = 1;
The problem is I am using spawn pages and thus its hard to use the above bit of code to hide all potential buttons.
Is there a bit of code that can select all buttons or cycle through all buttons on my pdf and hide them?
Cheers,
Seb.
Yes. You can use this code to do it:
for (var i=0; i<this.numFields; i++) {
var f = this.getField(this.getNthFieldName(i));
if (f==null) continue;
if (f.type=="button") f.display = display.hidden;
}
Copy link to clipboard
Copied
Yes. You can use this code to do it:
for (var i=0; i<this.numFields; i++) {
var f = this.getField(this.getNthFieldName(i));
if (f==null) continue;
if (f.type=="button") f.display = display.hidden;
}
Copy link to clipboard
Copied
Thanks try that works great.
One other question is there a way to test button/field visibility in an if statement.. something like this:
if( getField("Button_Name").display = 1) {
//Do Something
} else {
//Do Something Else
}
Cheers,
Seb.
Copy link to clipboard
Copied
Yes, but the comparison operation is "==", not "=". That's the value assignment operator... It's a common mistake.