restrict number of characters in a field?

Frank D. Engel, Jr. fde101 at fjrhome.net
Wed Jul 26 20:26:48 EDT 2006


Note that this code will not prevent pasting or drag-and-dropping of  
larger  blocks of text into the field.  It only works for text newly  
typed from the keyboard.

On Jul 26, 2006, at 12:14 AM, Kay C Lan wrote:

> On 7/26/06, Peter T. Evensen <pevensen at siboneylg.com> wrote:
>>
>>
>> on keyDown pKey
>>     if the length of the text of me < 5 then
>>          pass keyDown
>>     end if
>> end keyDown
>
> (note, this hasn't been tested, but just written off the top of my  
> head)
>
>
> Tested and it works fine.
>
> Here is a slight amendment to cater for large doses of text and touch
> typists who don't usually look at the screen and may wonder where  
> the last
> dozen characters went.
>
> on keyDown pKey
>  if (the length of the text of me > 254) then
>   beep
> else
>   pass keyDown
> end if
> end keyDown
>
> This allows 255 (yes that is correct) characters in a field before  
> it will
> start beeping at you. This has been tested and comes with a 12" or  
> 12sec
> guarantee, which ever comes first:-)
>
> HTH
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your  
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution
>



___________________________________________________________
$0 Web Hosting with up to 200MB web space, 1000 MB Transfer
10 Personalized POP and Web E-mail Accounts, and much more.
Signup at www.doteasy.com




More information about the Use-livecode mailing list