Unfortunately, the "columns" property refers only to the size of the form control. It means it will have a width that accommodates two characters. if the user types more, it will not receive any errors.
Currently, the text field form control doesn't have a mechanism to enforce such a behavior, but perhaps we can find some alternatives:
1. If these two characters come from a set of predefined values, you can use a read only combo box form control in which the user can only choose one of the existing values.
2. Through a Schematron rule
, you can detect the cases when the user puts more characters and issue a warning. This warning will appear when the user commits the value into the document (in other words, it presses Enter or loses focus)
3. Implement a custom form control
that has these checks. You can extend or start from the code of the existing form control to make things easier.
Depending on which path you which to take, I can provide more details about what you should do.