I'm trying to hide a button based on a null value check of 5 page items.
I'm starting out by hiding the button on page load, and then using the DA to show it if all fields are not null.
My button static id is create_btn
in a region called buttons
Here is my JavaScript expression.
function checkFields() {
const field1 = apex.item("P4_NAME_MAIL").getValue();
const field2 = apex.item("P4_ADDRESS_MAIL").getValue();
const field3 = apex.item("P4_CITY_MAIL").getValue();
const field4 = apex.item("P4_STATE_MAIL").getValue();
const field5 = apex.item("P4_ZIP_MAIL").getValue();
const buttonItem = apex.region("buttons").getItem("create_btn");
if (field1 && field2 && field3 && field4 && field5) {
// All fields are not null, show the button
if (buttonItem) {
buttonItem.show();
buttonItem.setLabel("Submit");
}
} else {
// One or more fields are null, hide the button
if (buttonItem) {
buttonItem.hide();
}
}
}
But when I test this the button is never showed? Thanks for any help.
Oracle APEX 24.1.1