Hi,
I need to disable checkbox based on selected radio button, for example:
If my selection is “Option A”, the checkbox must be disabled, but if my selection is “Option B”, all checkbox must be enabled. (Attachment)
On checkbox properties, I set a variable X on “Disabled”, so if I click on Option A this variable X is “true”, but it’s not refreshing.
Can someone help me?
Thanks!
Luis:
The values don’t refresh until the portlet is submitted. Try with Client Side javascript instead.
Regards.
Norberto.
Norberto,
Could you please tell me how it’s works? I’ve tried some examples and it didn’t work, it’s my first time using js on CAF.
Thanks!
Hi Luis:
It’s hard to explain the whole matter in a post.
First you need to read the full Client Side Model reference.
Also, search the forum. It has a lot of threads with examples.
Regards.
Norberto.
Solved!
Just put a js code in OnClick, like:
var radioGroup1 = CAF.model('#{activePageBean.clientIds['radioGroup1']}');
var radioGroup2 = CAF.model('#{activePageBean.clientIds['radioGroup2']}');
CAF.model('#{activePageBean.clientIds['radioGroup2']}').setValue(null);
if (radioGroup1.getValue() == 0)
{
radioGroup2.setDisabled(true);
}
else{
radioGroup2.setDisabled(false);
}