Skip to Main Content

APEX

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Conditional Page Submit

TinkerBoy3 days ago

Hi all. I have a page that works 100% if the page is submitted. Now I need to add a check that a trip total is 0.

If the value is 0 then I should ask the question if that is correct. If it is correct, then the page should be submitted if not nothing should happen.

So I have this javascript code

(function () {
// Get the button and its configured request value
var btn$ = $("#SUBMIT"); // Static ID
var req = btn$.attr("data-request") || "SUBMIT"; // Button > Request

// Get the value to check
var val = $v("P111_TOTAL_COST_1");

function doSubmit() {
// Explicitly request submit + validations + spinner
apex.page.submit({ request: req, showWait: true, validate: true });
}

// Let server validations handle blank / non-numeric
if (val === "" || isNaN(val)) {
doSubmit();
return;
}

if (Number(val) === 0) {
apex.message.confirm(
"The Total Estimated Running Cost of the Trip is 0. Are you sure this is correct?",
function (ok) { if (ok) doSubmit(); }
);
} else {
doSubmit();
}
})();

The check works and it stops the submit. But if I submit the page it seems that the page processing is not fireing as the first step of the page process get a primary key value. This is not happening if I fire the page submit from Javascript.

What am I missing?

Comments
Post Details
Added 3 days ago
2 comments
62 views