I would say your best bet is to make it initially a single-line textfield,
listen for the onChanged handler and do some metrics on it (getTextExtent),
if it passes a certain width, set autoSize and multiline. You could possibly
also try listening for a Key event and ignore the one for ENTER. Not sure if
that'll work 100% though.



-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of john hoffsis
Sent: Wednesday, March 21, 2007 2:55 PM
To: flashcoders@chattyfig.figleaf.com
Subject: [Flashcoders] disabling carriage returns in multiline input
textfields

Does anyone know if it's possible to restrict hard returns in text input
fields (fields must wrap)? 
    
  I have form fields to capture user input that I'm sending up to the
server to be stored in a database. When I request this stored data from  the
server, anything after a hard return is lost.
    
    I've tried something like this:
  my_txt.restrict="^\u0013", and a bunch of variations thereof, but  nothing
seems to keep the Enter key from doing it's thing. 
      
  Second best would be to traverse through a string a user has entered  and
replace hard returns with a space or dash, but again I've had no  luck
looking for \n or \r. I've tried entering text and hard returns  into a
dynamic textfield set to input, but when I try this:
      var n:Number = my_txt.indexOf("\n")...
      trace("n: "+n) //traces "n: -1"
        
      Anyone have any insight into this?
    
    Thanks,
    John
_______________________________________________
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

_______________________________________________
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

Reply via email to