UI policy

Akshaya14
Tera Contributor

Hi Team,

I have one requirement in form level. I have three field Ex. A, B, C (all checkbox)

if A is  unchecked, B and C should read only and clear value

if A is checked, B and C should editable

if A and B is checked C should be read only and value should cleared

if A and C is checked B should be read only and value should cleared 

Note: All Have OOB Ui policy for if A is  unchecked, B and C should read only and clear value

 

 

5 REPLIES 5

Harish Bainsla
Kilo Patron
Kilo Patron

function onChangeCheckbox(fieldName) {
var checkboxA = g_form.getValue('A');
var checkboxB = g_form.getValue('B');
var checkboxC = g_form.getValue('C');

if (fieldName == 'A') {
if (!checkboxA) {
g_form.setReadOnly('B', true);
g_form.setValue('B', false);
g_form.setReadOnly('C', true);
g_form.setValue('C', false);
} else {
g_form.setReadOnly('B', false);
g_form.setReadOnly('C', false);
}
} else if (fieldName == 'B') {
if (checkboxA && checkboxB) {
g_form.setReadOnly('C', true);
g_form.setValue('C', false);
}
} else if (fieldName == 'C') {
if (checkboxA && checkboxC) {
g_form.setReadOnly('B', true);
g_form.setValue('B', false);
}
}
}