Make choices in multiple choice read-only and select one by default.

KaMmILa__
Tera Expert

I have a variable on Order guide which is multiple choice which has 4 radio buttons, I want to make 3 of them read only and select one by default

I tried Onload cS but it seems not working , can some one help me with the scrip

find_real_file.png

1 ACCEPTED SOLUTION

OK, so I don't know if you need me to tell you this, but when you remove the Default Value the first choice will be the default value, so if that's what you want, all you need is the UI Policy.  If you want a different choice there are a few options - you can see which you prefer, or works with whatever else you have going on in this OG.

1) In your Catalog UI Policy on the Order Guide (not variable set) that is making the variable Read only, on the Script tab, check the Run scripts box, then this is the Execute if true script.

function onCondition() {
	g_form.setValue('test', 2);
}

2)  If you already have an onLoad Catalog Client Script on the Order Guide, you can add the setValue line to that instead of in the UI Policy, and you can add a g_form.setReadOnly to the client script, and not need the UI Policy at all.

View solution in original post

6 REPLIES 6

Brad Bowman
Kilo Patron
Kilo Patron

The best way to accomplish this is to create a Catalog UI Policy on the Order Guide to set the multiple choice variable to read only.

find_real_file.png

  Then, in the variable definition on the Default Value tab, enter the Value of the choice that you would like to be selected.

find_real_file.png

Voila!

find_real_file.png

 

KaMmILa__
Tera Expert

that variable is used in 40 other Cat items , can we set the value using client script?

Sure, but isn't this on an Order Guide - or did you add it to the OG in a variable set?  The onLoad Catalog Client Script should still be able to set the value even with the UI Policy making it read only.  If it can't get rid of the UI Policy then the onLoad Catalog Client Script will set the value then make it RO.

Thanks Brad, 

Sorry for the confusion. I am talking about setting the value. Yes that variable is on the variable set and VS is used in the Order guide