Field handling
I have the following code (which probably isn't written the most efficient)....
// TURN ON ALL EYE ICONS FOR THIS PAGE
if (this.getField("groundState") != null){
var getState = this.getField("groundState");
var theFieldsPage = getState.page;
if (getState != null) {
// Look through the fields page numbers
for (var z = 0; z < theFieldsPage.length; z++) {
// Find the field on the right page
if (theFieldsPage
== this.pageNum) { // Only change the display of the field on this page
getField("groundState." + z).display = display.hidden;
}}}
}
// TURN ON ALL EYE ICONS FOR THIS PAGE
if (this.getField("021state") != null){
var getState = this.getField("021state");
var theFieldsPage = getState.page;
if (getState != null) {
// Look through the fields page numbers
for (var z = 0; z < theFieldsPage.length; z++) {
// Find the field on the right page
if (theFieldsPage
== this.pageNum) { // Only change the display of the field on this page
getField("021state." + z).display = display.hidden;
}}}
}
// TURN ON ALL EYE ICONS FOR THIS PAGE
if (this.getField("032state") != null){
var getState = this.getField("032state");
var theFieldsPage = getState.page;
if (getState != null) {
// Look through the fields page numbers
for (var z = 0; z < theFieldsPage.length; z++) {
// Find the field on the right page
if (theFieldsPage
== this.pageNum) { // Only change the display of the field on this page
getField("032state." + z).display = display.hidden;
}}}
}
It is applied to a button. If the field groundState exist and 032state exists.... how do I get it to hide those fields?
So 021state doesn't exist in this particular document... I thought if I put it != null that would work. Currently it only hides the field groundState and doesn't hide the 032state field as it should.
Any suggestions would be most appreciated! Feel free to make suggestions for optimizing the script as well ![]()
Thanks in advance!
