
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-16-2016 08:22 AM
I'm trying to force a confirm with an on submit script. It is displaying that popup but no matter if the user hits ok or cancel it will still proceed to checkout or add the item to the cart even thought I am returning false. Any ideas on why I am seeing this behavior?
function onSubmit() {
//Type appropriate comment here, and begin script below
var req = g_form.getValue('requesttype');
if (req == 'New / Modify Account'){
var role = g_form.getValue ('role');
if (role == 'Due Diligence Data Management (no course required)' ||
role == 'Due Diligence TMF (no course required)'){
return true;
}
else {
var training = new GlideRecord ('u_trackwise_roles');
training.addQuery('u_role', role);
training.query(function(training){
if (training.next()){
var conf = confirm('Have you completed course(s) ' + training.u_ilearn_course + ' in iLearn. Click Ok to sbumit your request or cancel if you have not completed the training.');
}
if(conf) {
alert (conf);
return true;
}
else {
alert (conf);
return false;
}
});
}
}
else {
return true;
}
}
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-16-2016 10:27 AM
Try this:
function onSubmit() {
//Type appropriate comment here, and begin script below
var req = g_form.getValue('requesttype');
if (req == 'New / Modify Account') {
var role = g_form.getValue ('role');
if (role == 'Due Diligence Data Management (no course required)' || role == 'Due Diligence TMF (no course required)'){
return true;
} else {
var training = new GlideRecord ('u_trackwise_roles');
training.addQuery('u_role', role);
training.query();
if (training.next()) {
return confirm('Have you completed course(s) ' + training.u_ilearn_course + ' in iLearn. Click Ok to submit your request or cancel if you have not completed the training.');
}
}
}
else {
return true;
}
}
- Hardik Vora
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-16-2016 08:57 AM
Brian
function onSubmit() {
//Type appropriate comment here, and begin script below
var req = g_form.getValue('requesttype');
if (req == 'New / Modify Account') {
var role = g_form.getValue ('role');
if (role == 'Due Diligence Data Management (no course required)' ||
role == 'Due Diligence TMF (no course required)'){
return true;
} else {
var training = new GlideRecord ('u_trackwise_roles');
training.addQuery('u_role', role);
training.query(function(training){
if (training.next()){
return confirm('Have you completed course(s) ' + training.u_ilearn_course + ' in iLearn. Click Ok to sbumit your request or cancel if you have not completed the training.');
}
});
}
}
else {
return true;
}
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-16-2016 09:54 AM
This did not work.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-16-2016 09:21 AM
Hi ,
Define variable var conf = false; on line number 3. See below and correct line number 15 of your code.
- function onSubmit() {
- //Type appropriate comment here, and begin script below
- var req = g_form.getValue('requesttype');
- if (req == 'New / Modify Account'){
- var conf = false;
- var role = g_form.getValue ('role');
- if (role == 'Due Diligence Data Management (no course required)' ||
- role == 'Due Diligence TMF (no course required)'){
- return true;
- }
- else {
- var training = new GlideRecord ('u_trackwise_roles');
- training.addQuery('u_role', role);
- training.query(function(training){
- if (training.next()){
- conf = confirm('Have you completed course(s) ' + training.u_ilearn_course + ' in iLearn. Click Ok to sbumit your request or cancel if you have not completed the training.');
- }
- if(conf) {
- alert (conf);
- return true;
- }
- else {
- alert (conf);
- return false;
- }
- });
- }
- }
- else {
- return true;
- }
- }

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-16-2016 09:54 AM
This did not work