Forum Discussion
ELANAMETH
6 years agoQrew Cadet
Thank you so much!, but I am trying to incorporate something like this:
if (confirm("Are you sure you want to mark complete?")) {
//(if yes) execute the api (which is sitting in a variable)
} else {
// alert that record was not saved
}
Here is part of my code with the following variables (it's all in a URL formula):
$popup: "javascript:confirm('...')
$url: the API that is editing the current record
$Cancel: "javascript:alert('....')
"javascript:" &
"$.get('" & $popup &
"',function() {" &
"if ($popup == true) {" &
& $url &
"} else {"
& $Cancel &
"});" &
"void(0);"
if (confirm("Are you sure you want to mark complete?")) {
//(if yes) execute the api (which is sitting in a variable)
} else {
// alert that record was not saved
}
Here is part of my code with the following variables (it's all in a URL formula):
$popup: "javascript:confirm('...')
$url: the API that is editing the current record
$Cancel: "javascript:alert('....')
"javascript:" &
"$.get('" & $popup &
"',function() {" &
"if ($popup == true) {" &
& $url &
"} else {"
& $Cancel &
"});" &
"void(0);"
AustinK
6 years agoQrew Commander
Does this help you more?
var text popup = "javascript:confirm('testing this')";
var text url = "javascript:alert('totally okay!')";
var text cancel = "javascript:alert('cancelled!')";
"javascript:" &
"if(!confirm('testing this')){" &
$cancel &
"} else {" &
$url &
"};"
At the bottom in the else you would do your $get for the url instead of the popup box. As you can see I am doing !confirm instead of just confirm, so that is saying if confirm is false. So if the user clicks okay it will be true and continue down to the $url part.
I didn't test this but you can try.
"javascript:" &
"if(!confirm('testing this')){" &
$cancel &
"} else {" &
"$.get('" & $url & "');" &
"};"
var text popup = "javascript:confirm('testing this')";
var text url = "javascript:alert('totally okay!')";
var text cancel = "javascript:alert('cancelled!')";
"javascript:" &
"if(!confirm('testing this')){" &
$cancel &
"} else {" &
$url &
"};"
At the bottom in the else you would do your $get for the url instead of the popup box. As you can see I am doing !confirm instead of just confirm, so that is saying if confirm is false. So if the user clicks okay it will be true and continue down to the $url part.
I didn't test this but you can try.
"javascript:" &
"if(!confirm('testing this')){" &
$cancel &
"} else {" &
"$.get('" & $url & "');" &
"};"