Client Script onSubmit Popup Messge

jmillwood
Giga Contributor

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.");

}
}

 

5 REPLIES 5

Pedro Lopez
Kilo Guru

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

JMitchell
Kilo Expert

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.");

}
}

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

 

 

 

Hi,

Write below code in onChange Client script.

if(newValue || newValue!='597754e5132b4304c2783d27d144b08f') 

{
alert("Please select the Activity below and provide all applicable details.");

}