Issue
A form field with a max length set allows you to input more characters than the specified max length
Release
All
Cause
This is a known platform issue: PRB825271
Resolution
This can be resolved with an onChange client script that monitors the field and rejects the new value if it is over the desired length.
1) Navigate to System Definition > Client Scripts and click the New button at the top of the list
2) Give the script a name
3) Select the target table
4) Set the UI Type as desired
5) Set the Type to onChange
6) Select the target field in Field name
7) Add script similar to the script shown below, replace 2 with the desired limit
8) Submit the record
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
// check the new value length, if it's greater than 2, reset to the old value
if(newValue.toString().length > 2) {
g_form.setValue('u_target_field', oldValue);
return;
}
}