PopUp/Alert Record Producer

Elizabeth26
Tera Contributor

Hi,

 

I am trying to figure out the best way to create a pop-up/alert box with text and an okay button inside a record producer on the form as a customer is selecting 2 fields that meet 2 separate criteria. 

 

I need to have it based upon 2 values

1. If it's a certain location

AND

2. If it's certain categories

 

Both must apply. 

8 REPLIES 8

Danish Bhairag2
Tera Sage
Tera Sage

Hi @Elizabeth26 ,

 

You can look at the below code :

 

function onSubmit() {

   //Type appropriate comment here, and begin script below.

   var loc = g_form.getValue('location'); // enter proper backend name of ur variable.

var cat = g_form.getValue('categories')//enter proper backend name of ur variable.

If (loc == 'desiredValue' && cat == 'desiredCat'){

   var answer = confirm('Enter desired text');

}

 

// use this if u want to restrict users from submitting it they press cancel

   if(!answer){ // if cancel is pressed it will not allow the record producer to submit

 return false;

   }

   

}

 

Please mark my answer helpful & accepted if it helps you resolve your query.

 

Thanks,

Danish

It appears it does not work because I am unable to dot walk to the parent field I need to trigger off of in the catalog client script.

Is there a way around this?

Sayali Gurav
Tera Guru
Tera Guru

Hello @Elizabeth26 ,

You can try it by creating catalog client script. 

 

Type = On Submit

Applies on a Catalog Item view  = True
Applies on Requested Items = True
Applies on Catalog Tasks = True
UI Type = All

SayaliGurav_0-1695711118565.png

function onSubmit() {
    //Type appropriate comment here, and begin script below
    var copier = g_form.getValue('copier_reams'); // create a new variable and enter proper backend name of location to get value of location
    var screen = g_form.getValue('screen_wipes'); //create a new variable and enter proper backend name of categories to get value of categories.
    if ((copier == 1) && (screen == 2)) // enter certain location & certain categories
{   
        alert(" alert."); //Enter appropriate alert message
    }
}
 
Please mark helpful or correct if applicable.
Thanks & Regards, 
Sayali Gurav

I tried this but it did not trigger on submit.