Our Blog

I wonder if this is a bug.
This is the scenario: you have a TextField to which you have applied a TextFormat. Then you try to add some text to the TextField. There are two possible outcomes of doing that: if it is an HTML TextField, the formatting is preserved after inserting the additional text, as you would expect. But if it is a non-HTML TextField, all formatting is lost when the text is added.
An example of this:
After pressing "Add Text", the String "is a long" loses its formatting in the non-HTML TextField
This is the code:
t = "this is a long text bla bla bla bla bla";

tfield1.html = true;
tfield1.border = true;
tfield1.htmlText = t;

tfield2.html = false;
tfield2.border = true;
tfield2.text = t;

var tformat = new TextFormat();
tformat.bold = true;
tformat.italic = true;

tfield1.setTextFormat( 4 ,15, tformat );
tfield2.setTextFormat( 4 ,15, tformat );

but.onRelease = function()
{ tfield1.htmlText += " more text "; tfield2.htmlText += " more text "; }
Nahuel Foronda

Nahuel Foronda


  1. adrian
    Have a look at setNewTextFormat() as opposed to setTextFormat()
  2. Hello,

    I'm also having problems with setNewTextFormat and html textfields.

    Don't you?
  3. Joseph Balderson
    HTML textfields can be used with setNewTextFormat, but the formatting applies to the entire field (or an index selection if you are using the second and third parameters of the method) -- all text-related formatting with HTML tags are ignored. In order to get HTML tag formatting to work within an HTML textfield, you need to use a TextField.StyleSheet object, either defined in actionscript or as an external CSS stylesheet.
  4. Lesley
    I have an input box that allows the user to search on what they put in the box. I would like for the box to always enter data in uppercase no matter if the user has caps on or not. Is there a way to do this?

    Here is my code for the input box.
    <!--- Matl Description Input Box --->
                <cfformgroup type="vbox" style="verticalGap:-5">
                   <cfformitem type="text" style="fontWeight:bold;">Matl Description:</cfformitem>
                   <cfinput type="text" name="Material_Description"
                      onKeyDown="if(Key.isDown(Key.ENTER)) {submitForm()}">