Re: [Flashcoders] disabling carriage returns in wrapping text fields

2007-03-21 Thread R�kos Attila

Flash uses \r (0x0D) only in text fields. All occurencies of \n (0x0A)
are replaced with \r. E.g. if you assign "foo\nbar" to a text field
and read the value back, it will turn to "foo\rbar".

For replacing certain characters use String.split() and
String.join().

However, it would be better to check the server-side script, since it
is probably not perfect if some data can lost during the process.

  Attila

jh> Does anyone know if it's possible to restrict hard returns in text input 
fields (fields must wrap)?
jh>   
jh>   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.
jh>   
jh>   I've tried something like this:
jh> my_txt.restrict="^\u0013", and a bunch of variations thereof, but 
nothing seems to keep the Enter key from doing it's thing. 
jh> 
jh> 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:
jh> var n:Number = my_txt.indexOf("\n")...
jh> trace("n: "+n) //traces "n: -1"
jh>   
jh> Anyone have any insight into this?


___
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


RE: [Flashcoders] disabling carriage returns in wrapping text fields

2007-03-21 Thread Steven Sacks | BLITZ
You could fake it and instead of using an input textfield, capture
keystrokes and put them into a dynamic textfield.  :)

You could also validate the input textfield on every key up event and
strip any carriage returns out then.

INP_Field.text =
INP_Field.text.split("\n").join("").split("\r").join("");

:)
___
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