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

You may want to look into changing this to a onChange script like Shweta is suggesting, just change the OR ( || ) to AND (&&). If you require it to work onSubmit, try this:

function onSubmit() {
var field1 = g_form.getControl('u_how_will_we_address_the_impact'); // != '597754e5132b4304c2783d27d144b08f');
var field1value = g_form.getUniqueValue('u_how_will_we_address_the_impact');

if(field1.changed && field1value != '597754e5132b4304c2783d27d144b08f'

{

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

}
}