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

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.

Rajesh Chopade
Kilo Expert

You can also call the button element itself. For example if your buttons name is 'Test Me', you could do the following in an onChange or onLoad client script. The button id ends up being your button name with _ instead of spaces, and all lower case (in this case test_me).

var it = document.getElementById('test_me');
it.disabled = true;
it.style.backgroundColor = '#cccccc';