How to revert the condition if the condition is false

Community Alums
Not applicable

Suppose I have created a catalog item in which there are 4 fields and I am using a catalog UI policy like..
condition 1:-
var1,var2 is visible
condition 2:-
var2,var3 is visible
condition 3:-
var3,var4 is visible.

It is working fine till here.
Now, I want to use a catalog client script because for condition 2. I want the label of field (var2) should be different.
var example = getMessage('XXXXXX');
g_form.setLabelOf('var2', example);

The issue is that:-

from here if I again go to first condition then the label of var2 is remains same.

Please provide me the solution.

Thanks & Regards
Utsav

1 ACCEPTED SOLUTION

Bharath Kumar A
Mega Sage

Could you please explain exact scenario.

In general,For catalog client script

you have to use else condition to reverse your logic when condition not met.

View solution in original post

4 REPLIES 4

Bharath Kumar A
Mega Sage

Could you please explain exact scenario.

In general,For catalog client script

you have to use else condition to reverse your logic when condition not met.

Community Alums
Not applicable

Yes,

if(condition==true){

var example = getMessage('XXXXXX');
g_form.setLabelOf('var2', example);

}

else{

}

In "else" part what should I write so that the label of variable should remain as previous one.

In "if" condition we are changing the label of var2.

Thanks

Bharath Kumar A
Mega Sage

if you are writing onChange client script.

in else part you can write

else

{

g_form.setLabelOf('var2', oldValue);

}

Community Alums
Not applicable

Hii @Bharath Kumar A 
I have used your condition in else part but in place of var2 the label is empty..
It is showing nothing in that label..please help me out..

Thanks & Regards
Utsav