How to update Multiple choice field based on Single text field having Client Script Floating Validat

VIKASM535239375
Kilo Sage

How to update Multiple choice field based on Single text field having Client Script Floating Validation in Catalog Item?

If Single Text Floating field is less than 500 option1 to be selected.

If Single Text Floating field is greater than 500 option2 to be selected.
2 REPLIES 2

Shivalika
Mega Sage

Hello @VIKASM535239375 

 

Did the catalog client script not working ? Are you showing or hiding options as well ? 

 

Can you share screenshot of what you have done until now ? 

 

Kindly mark my answer as helpful and accept solution if it helped you in anyway. This will help me be recognized for the efforts and also move this questions from unsolved to solved bucket. 

 

Regards,

 

Shivalika 

 

My LinkedIn - https://www.linkedin.com/in/shivalika-gupta-540346194

 

My youtube - https://youtube.com/playlist?list=PLsHuNzTdkE5Cn4PyS7HdV0Vg8JsfdgQlA&si=0WynLcOwNeEISQCY

Robert H
Mega Sage

Hello @VIKASM535239375 ,

 

There you go. Please just put in your own variable and option names.

 

RobertH_1-1744143700851.png

 

function onChange(control, oldValue, newValue, isLoading) {
    if (isLoading || newValue == '') {
        return;
    }

	g_form.clearValue('multiple_choice_field');
    if (newValue < 500) {
		g_form.setValue('multiple_choice_field', 'option1');
    } else if (newValue > 500) {
		g_form.setValue('multiple_choice_field', 'option2');
	}
}

 

The script will not select any option when the input is not a number, or if the user entered the exact number 500, which is excluded in your requirement but that may be by mistake.

 

Regards,

Robert