It is not the first time I see, on forums, questions about how to restrict, at runtime, the number of characters a user can enter in a text item.
The solution consists in understanding that every standard Forms widget has an associated PJC that can be handled by the Set_Custom_Property() built-in..
Concerning a Text Item, the property to use with this method is : MAX_LENGTH
In the following sample, I restrict the user entry to a maximum of 10 characters in the :BL.TXT Text Item:
Set_Custom_Property('BL.TXT', 1, 'MAX_LENGTH', 10 ) ;