Copy link to clipboard
Copied
Hi,
Is it possible to either hide or reveal a button with a graphical icon, dependent upon another field value?? I am trying to get the button ("Button1") to display based upon the field "ZFW" value, if "ZFW" is in the range >=18.0 and <=22.0...
I know how to solve the above with a text field, but not sure if its possible to use the button object (with icon) and run the same Javascript (Mouse Up/Mouse Down/On Focus/On Blur) - i've tried what i have currently and seems not, which may be down to the lack of custom calculation script possibility with a button?.
if (this.getField("ZFW").value >= "18.0" && this.getField("ZFW").value <= "22.0" ) {
event.target.display = display.visible;
}
else{
event.target.display = display.hidden;
}
If you want that the button will be made visible/hidden when the value of the text field changes you need to place the code under the text field's validation or calculation event, as buttons do not trigger any events like that, and change it to the following:
if (event.value >= 18 && event.value <= 22 ) {
this.getField("Button1").display = display.visible;
} else{
this.getField("Button1").display = display.hidden;
}
Copy link to clipboard
Copied
Use a script at validation of field "ZFW".
Copy link to clipboard
Copied
Drop the quotes around the numbers.
Copy link to clipboard
Copied
Thanks for the replies Bernd/try67 - I should add that it's the button object I am attempting to either have either visible or hidden, based upon the value in the "ZFW" field....the script I supplied in original post is what I was hoping to use in the button object itself, but doesn't appear to be possible? (quotes dropped by the way...).
Copy link to clipboard
Copied
If you want that the button will be made visible/hidden when the value of the text field changes you need to place the code under the text field's validation or calculation event, as buttons do not trigger any events like that, and change it to the following:
if (event.value >= 18 && event.value <= 22 ) {
this.getField("Button1").display = display.visible;
} else{
this.getField("Button1").display = display.hidden;
}
Copy link to clipboard
Copied
Thanks try67 😉