Page 1 of 1
limited number of characters input into the text box
Posted:
Wed Nov 07, 2012 5:24 am
by vsoong
How can I limit the number of characters that can be entered into a text box? For example, a maximum of only 4 characters can be entered into the text box
--------------
| abcd |
--------------
instead of 8 characters as shown below
--------------
| abcdefgh |
--------------
I don't want to give the impression that the table will accept 8 characters when it will only accept 4.
Re: limited number of characters input into the text box
Posted:
Wed Nov 07, 2012 10:19 am
by jdbruijn
You can do that by setting the size of the database field.
I think you can also use the format field for this, although I haven't tried that yet.
Re: limited number of characters input into the text box
Posted:
Thu Nov 08, 2012 4:09 am
by vsoong
I have tried setting the size of the database field to 4 and the text box still accept more than 4 characters. Sometimes I set the data provider of the text box as a variable instead of a database field. As the size of a variable cannot be set, the text box will simply accept many, many characters.
I don't think setting a format for a text box will limit the number of characters in it. Format will determine the kind of thing you can enter in the text box, e.g. 1 or a or A or 12/03/2012.
Re: limited number of characters input into the text box
Posted:
Thu Nov 08, 2012 9:20 am
by lwjwillemsen
In Foxpro we had the MaxLength property on a textbox...
Regards,
Re: limited number of characters input into the text box
Posted:
Thu Nov 08, 2012 9:27 am
by Peter de Groot
Hi,
You could use KeyListeners Plugin,
https://www.servoyforge.net/projects/keylisteners, to test how many characters a text box holds and act on that.
Regards,
Peter
Re: limited number of characters input into the text box
Posted:
Thu Nov 08, 2012 11:05 am
by Joas
There is already a feature request for this that you can watch/vote for:
https://support.servoy.com/browse/SVY-2611
Re: limited number of characters input into the text box
Posted:
Thu Nov 08, 2012 11:44 am
by vsoong
Thanks, Joas