How to display alert message/popup with details of variable?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-25-2023 11:24 AM
Hi everyone,
Can anyone help me as I need to display a alert message after a catalog item is submitted for the user to confirm the variable "request_name" is correct. The script should give the user the opportunity to confirm the details are correct or cancel the request. Is this possible?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-25-2023 11:51 AM
Hi @Gemma4 ,
You can write an onSubmit client script where u can have this below script for putting up a confirmation message before submitting it
var answer = confirm('Are the variables correct?')//update message as per your need
If(!answer){
return false;
}
Please mark my answer helpful & accepted if it helps u resolve your query.
Thanks,
Danish
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-25-2023 12:00 PM
I tried the script you provided and it gives an error. see attached.
I tried a catalog client script and it displayed the pop up message but did not include the variable results for request_name. See attached. any other ideas?
function onSubmit() {
g_form.getReference('request_name', doPopup);
// g_form.getReference('requested_for', doPopup);
}
function doPopup(reqFor) {
var popup = confirm('Are you sure the request name field is correct ' + reqFor.getValue('name') + '?');
// alert('popup val is: ' + popup);
// if (!popup) {
// return false;
// } else {
// return false;
// }
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-25-2023 12:22 PM - edited 09-25-2023 12:25 PM
Hi @Gemma4 ,
Please see the below screenshots
function onSubmit() {
//Type appropriate comment here, and begin script below.
var value = g_form.getValue('first_name'); // enter your variable name which u want to print on alert
var answer = confirm('Are the entered variables correct First Name: '+ value);
if(!answer){ // if cancel is pressed it will not allow the catalog item to submit
return false;
}
}
Please mark my answer helpful & accepted if it helps you resolve your query.
Thanks,
Danish