Forum Discussion
- _anomDiebolt_Qrew EliteSomething as simple as this will work:
if(confirm("Do you want to continue?")) {
If you want a better dialog box and more options used jQueryUI Dialog as shown in this demo:
//run code
}
https://haversineconsulting.quickbase.com/db/bkw2ff3e3?a=q&qid=1 - EOMDeveleporsQrew CaptainThanks Dan!
I am doing this in myCript page.
I have a prompt:
var description= prompt("Enter a brief description of the work done in this session: ", "");
if the user cancels within the prompt window then don't want to run the code. I tried putting the if statement but it does not seem to work:
See in bold what I added
(function(){
var dbid = "bnqepesti";
var dbidTable = dbid;
var apptoken = "my app token";
$.ajaxSetup({data: {apptoken: apptoken}});
var description= prompt("Enter a brief description of the work done in this session: ", "");
if(confirm("Do you want to continue?")) {
var promise = $.get(dbidTable, {
act: "API_EditRecord",
rid: QBU_rid,
_fid_20: description,
_fid_6: "Out"
}).then(function(xml) {
console.dirxml(xml);
$.get() & location.reload(true);
});
})();} - EOMDeveleporsQrew CaptainI figured this out:
I entered these lines of code after the prompt line:
if (description == null || description == "") {
alert("You did not enter a description I will cancel this Time Out.");
Return;
}
This will alert and cancel the rest of the code if the user clicks cancel or leaves it blank and clicks ok.
I hope this can help others interested in implementing this in their apps.