I have a Form with a group of fields that I wish to make read-only until a check-box is checked. These fields contain data from a lookup. If the data is incorrect the user can check the check-box and update them.
While the check-box is not checked, the fields should be read-only
The following code changes the background of the fields to gray, as if they were read-only or disabled, but the user can still edit them.
Please advise if this code is correct.
//Disable group details until checkbox checked
{ $('.updategroup').attr('disabled', 'True');} //initial disable CSS 'updategroup'
$('.checkedit').click(function () {
if($('input[value="Yes"]').is(':checked')) //checkbox value = 'Yes'
{ $('.updategroup').removeAttr ('disabled');
}
else { $('.updategroup').attr ('disabled', 'True'); //hide again if un-checked
}
});
// end disable