Have you tried subclassing DateField and setting textInput.maxChars?

 

As for stopping keystrokes from being processed by a TextField,
TextInput, or TextArea, handle the 'textInput' event and call
preventDefault(), not stopPropagation() or stopImmediatePropagation().

 

- Gordon

 

________________________________

From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Libby
Sent: Tuesday, January 23, 2007 9:28 AM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Re: DateField - is there a way to limit the amount
of input allowed?

 

I have a DateField in which editing is allowed. I want to prevent the
user from typing more than "x" characters since "x + 1" characters
will not represent a valid date to my application. In other
programming languages my keypress handler would allow me to "consume"
the event, effectively putting a stop to typing beyond a certain
length. How can I do this in Flex, as so far my attempts at stopping
the event propagation have been ignored by the Flash player?

Thanks,
Libby

--- In flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com>
, Tom Chiverton <[EMAIL PROTECTED]>
wrote:
>
> On Tuesday 23 January 2007 13:45, Libby wrote:
> > Anybody? As far as I can tell, DateField doesn't take a maxChars
> > property, which would be the logical solution.
> >
> > --- In flexcoders@yahoogroups.com
<mailto:flexcoders%40yahoogroups.com> , "Libby" <libbychantel@> wrote:
> > > I used a keyboard listener to keep track of the length of the text
> > > entered, but Flex ignores my demands to preventDefault() and/or
> > > stopImmediatePropagation(). Does anyone have the secret they could
> 
> Can you be clearer about what you want to achieve ?
> For instance, I've never heard of those two methods, and so have no
idea how 
> they relate to what seems a fairly simple case of using a key press
handler 
> to truncate a form field.
> 
> -- 
> Tom Chiverton
> Helping to assertively maintain exceptional methodologies
> 
> ****************************************************
> 
> This email is sent for and on behalf of Halliwells LLP.
> 
> Halliwells LLP is a limited liability partnership registered in
England and Wales under registered number OC307980 whose registered
office address is at St James's Court Brown Street Manchester M2 2JF.
A list of members is available for inspection at the registered
office. Any reference to a partner in relation to Halliwells LLP means
a member of Halliwells LLP. Regulated by the Law Society.
> 
> CONFIDENTIALITY
> 
> This email is intended only for the use of the addressee named above
and may be confidential or legally privileged. If you are not the
addressee you must not read it and must not use any information
contained in nor copy it nor inform any person other than Halliwells
LLP or the addressee of its existence or contents. If you have
received this email in error please delete it and notify Halliwells
LLP IT Department on 0870 365 8008.
> 
> For more information about Halliwells LLP visit www.halliwells.com.
>

 

Reply via email to