onchange CS to set populated fields to read only and no populated to read only false
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-11-2024 10:07 AM - edited 09-11-2024 11:00 AM
i am trying to set fields that are empty to read only false and fields that are populated to read only when the caller name is changed some how the mandatory fields are still read only and empty when the caller changes..i made some alerts and it looks like its still checking the fields of the old values and not the new ones that get populated after the end user changes
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
var additionalInfoFields = ['u_end_user_email', 'u_end_user_phone'];
additionalInfoFields.forEach(function(fieldName) {
var fieldValue = g_form.getValue(fieldName);
if (fieldValue != ''|| fieldValue != null) {
g_form.setReadOnly(fieldName, true);
} else {
g_form.setReadOnly(fieldName, false);
}
});
}
0 REPLIES 0