How do I disable the #maxlength validation on a field I've added to the user entity form?
Let me explain: I want my field to be 10 characters long in the database, so I've set a max length of 10 at the field UI. However, at the form level I want it to have a formatting mask that makes it be 14 characters long.
Even though I could disable its #maxlength property via
hook_form_alter and get to enter more than 10 characters, the validation for such property is still up when I submit the form.
Since I don't want to remove the mask via JS by the time the form gets submitted, my intention was to to bypass form validation only for the max length property of this field (or even for the whole field) and then at a
presave hook I'd remove the mask and store only the original 10 characters to the database.
Hope I've made it clear.