I have a page where when the user submits, I check certain conditions and prompt the user with a confirmation ("are you really sure you want to submit this...?") and if they press OK (javascript true) continue to submit as normal, else (javascript false) the page should stop submitting.
I know I can do this by putting Javascript code on whatever buttons I need to such that they're prompted from whatever appropriate button but I then thought it might be more elegant to just put it in one place in a before-page-submit DA.
So I figured that in my DA for a before-page-submit I'd try explicitly returning true or false thinking that I returned true it would continue to submit but if false it would stop submitting. Unfortunately no dice.
Example:
Dynamic Action
Before Page Submit
Condition (Javascript Expression): (this.data=="SAVE")||(this.data=="MULTI_ROW_DELETE")
var response=checkPbcDml();
alert(response); //for debugging and I do properly get true or false back
if(!response)
return(false);
else
return(true);
So I'd like return(false) to stop the submission process (was only guessing that it'd work, and it doesn't). Is there any other javascript command that I could execute to cancel the submission processing?
Yes I know that I really can do this on my buttons and it'll work...
javascript:if(checkPbcDml())apex.confirm(htmldb_delete_message,'DELETE');
javascript:if(checkPbcDml())apex.submit('SAVE');
...but was just hoping to do something in the DA as a matter of elegance to put code in one place rather than two places.
Edited by: gti_matt on Jun 14, 2012 10:30 AM