how to fetch or get removed value from list collector variable in catalog client script

srikriti
Tera Contributor

Hi All,

i am trying to fetch the removed value from a list collector in catalog client script

Tried with on change client script oldValue but its showing always empty.

Is there any other way to fetch the details please provide the solution.

 

Thanks

 

3 REPLIES 3

Rahul Talreja
Mega Sage
Mega Sage

Hi @srikriti ,

OldValue Would not help here, as it store the value of the field which Is at the time of loading of the form.

Can you exactly tell, what are you trying to fetch, is it the temporary last selection made in the field(Not saved/submitted) or something else?

Please mark my response correct/helpful as applicable!
Thanks and Regards,
Rahul

Hi @Rahul Talreja 

yes the temporary last selection made in the field(Not saved/submitted) value

because 

on catalog form i want to use removed value
some dependency on old value is there

 

Hi @srikriti 

Got it,

You can create a variable previousValue and everytime, save a last value in that variable.

Refer the script below:

function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading) {
return;
}

var previousValue;
if (g_scratchpad.previousValue == undefined){
previousValue = oldValue;
}
else{
previousValue = g_scratchpad.previousValue;
}

g_scratchpad.previousValue = newValue;
}

Hope this might solve your problem!

 

Please mark my response correct/helpful as applicable!
Thanks and Regards,
Rahul