limited number of characters input into the text box

Find out how to get things done with Servoy. Post how YOU get things done with Servoy

limited number of characters input into the text box

Postby vsoong » Wed Nov 07, 2012 5:24 am

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.
vsoong
 
Posts: 7
Joined: Sat Aug 11, 2012 12:42 am

Re: limited number of characters input into the text box

Postby jdbruijn » Wed Nov 07, 2012 10:19 am

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.
Jos de Bruijn
Focus Feedback BV
Servoy Certified Developer
Image
jdbruijn
 
Posts: 492
Joined: Sun Apr 11, 2010 6:34 pm

Re: limited number of characters input into the text box

Postby vsoong » Thu Nov 08, 2012 4:09 am

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.
vsoong
 
Posts: 7
Joined: Sat Aug 11, 2012 12:42 am

Re: limited number of characters input into the text box

Postby lwjwillemsen » Thu Nov 08, 2012 9:20 am

In Foxpro we had the MaxLength property on a textbox...

Regards,
Lambert Willemsen
Vision Development BV
lwjwillemsen
 
Posts: 680
Joined: Sat Mar 14, 2009 5:39 pm
Location: The Netherlands

Re: limited number of characters input into the text box

Postby Peter de Groot » Thu Nov 08, 2012 9:27 am

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
User avatar
Peter de Groot
 
Posts: 215
Joined: Thu Jan 10, 2008 8:38 pm
Location: Not sure...

Re: limited number of characters input into the text box

Postby Joas » Thu Nov 08, 2012 11:05 am

There is already a feature request for this that you can watch/vote for: https://support.servoy.com/browse/SVY-2611
Joas de Haan
Yield Software Development
Need help on your project? yieldsd.com
User avatar
Joas
Site Admin
 
Posts: 842
Joined: Mon Mar 20, 2006 4:07 pm
Location: Leusden, NL

Re: limited number of characters input into the text box

Postby vsoong » Thu Nov 08, 2012 11:44 am

Thanks, Joas
vsoong
 
Posts: 7
Joined: Sat Aug 11, 2012 12:42 am


Return to How To

Who is online

Users browsing this forum: No registered users and 10 guests