Client Script onSubmit Popup Messge
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-25-2018 01:07 PM
Hello Community,
I have a popup message in Client Script, The message is happening on Field Change, however I also need to popup when a certain value is selected. How can I add in the additional condition into this script?
function onSubmit() {
var field1 = g_form.getControl('u_how_will_we_address_the_impact'); // != '597754e5132b4304c2783d27d144b08f');
if(field1.changed) // && field1 != '597754e5132b4304c2783d27d144b08f') <-- I need to add in an additional condition
{
confirm("Please select the Activity below and provide all applicable details.");
}
}
- Labels:
-
Incident Management
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-25-2018 01:16 PM
You need to create an "OnChange" client script. On this client script, you need to specify the field name and based on which value the pop message will be displayed. Example:
if(newValue == 'Test'){
alert("My message");
}
I hope this helps,
Pedro Lopez
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-25-2018 01:20 PM
Is that the field with the choice you want to trigger the alert? if so, try this:
function onSubmit() {
var field1 = g_form.getControl('u_how_will_we_address_the_impact'); // != '597754e5132b4304c2783d27d144b08f');
var field1value = g_form.getValue('u_how_will_we_address_the_impact');
if(field1.changed || field1value == 'enter the string value of the choice you want to trigger the notificication')
{
confirm("Please select the Activity below and provide all applicable details.");
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-25-2018 05:46 PM
Thanks J,
The issue is I don't want the message to popup if the value in the List field is '597754e5132b4304c2783d27d144b08f'
Also, if I go into the task and update the record, saving just a note it's still popping up the message.
I need it to only pop up if that field changes and doesn't change to that value
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-25-2018 10:46 PM
Hi,
Write below code in onChange Client script.
if(newValue || newValue!='597754e5132b4304c2783d27d144b08f')
{
alert("Please select the Activity below and provide all applicable details.");
}