It would be a nice feature to automatically add an upper limit on size restricted fields (ie. if the sys_title has a size of 1024, then it should automatically set/create a validation rule that says that the number of character input cannot be greater than that).
I really don’t think it is that practical to go through all the fields and manually add validation rules when you have already restricted the field size.
I agree. It would be nice if it would add those validators for you, especially since if you don’t add the validation and someone puts in too long a value, the error message that results is not helpful or friendly for the end user.
I agree, although this some of this is automatically done for you. For example, if you set the field size to be 80 then the max field will be set to 80.
This only happens when you create a new field. If you subsequently decide to change the length of a field (e.g. for some business/web-design reason the number of characters must be 60 instead of 80) then the automatically created validation remains unchanged*. Hence, any user who then edits or creates an item of this type, and enters too many characters, will get an error message (and if they go back in their browser they cannot edit the field, because the button to submit the Content Editor form is disabled by some JavaScript to stop double-clicking.) If the field in question is a shared field, there are bugs that make editing validation on those almost impossible.
There, to my knowledge, is no documentation on this so it is easy to miss. Especially as validation rules are hidden away in a separate dialog. You can end up with a system full of mismatched validation rules and storage sizes. We certainly have.
Also, MSM will complain when you copy this change over, if existing content exceeds the new limit. You need to trim the content with an SQL statement such as:
UPDATE <tablename> SET <fieldname> = SUBSTR(<fieldname>, 1, <newsize>)
WHERE LENGTH(<fieldname>) > <newsize>
Field limits also don’t apply to text area edit boxes or active-edit controls in Ephox. So built-in validation with friendly error messages would be quite helpful. We’ve been burned by this too.