The CreatorCon Call for Content is officially open! Get started here.

Get catalog variable value from OnChange Variable set client script

Marina15
Tera Expert

Hello .I need to get the value of catalog variable from the cline script in the variable set, but an empty value is returned. Maybe you know how to access variables? 

function onChange(control, oldValue, newValue, isLoading) {
   if (isLoading || newValue == '') {
      return;
   }
	
	alert(g_form.getValue("var1")); 
	if (g_form.getValue("var1") == 'b5dd5c831b40449ded78b04bcb07'){
		alert(g_form.getValue('var2')); // return empty value
                g_form.setMandatory("var3", true); // this doesn't work
	}
   
}

 

find_real_file.png

Thanks in advance!

3 REPLIES 3

Jaspal Singh
Mega Patron
Mega Patron

Is the variable var1 in the same variable set?

If not, better create a client script at Catalog item level instead of Variable set level.

yes , the same variable set. This is multi row variable set. I need that when changing a variable in a multirow variable set, a mandatory field appears, which is not in the variable set

Hitoshi Ozawa
Giga Sage
Giga Sage
Hi Marina,
It's not possible to access catalog variable from a client script in a variable set. It's necessary to create a client script in the catalog item instead of in a variable set.