A Flash Developer Resource Site

Results 1 to 14 of 14

Thread: input text field- how to prevent HTML formatting

  1. #1
    Senior Member Lyra's Avatar
    Join Date
    Oct 2001
    Location
    South Africa
    Posts
    243

    input text field- how to prevent HTML formatting

    Hi

    I am trying to create an input text field which does not insert HTML formatting to whatever the viewer types in it. For example, if the viewer puts the text "hello" into the text box, the value of the box should not be

    <p align="left"><font face="Times" size="18" color="#000000" letterSpacing="0.000000" kerning="1">hello</font></p>

    but just "hello"

    I have unchecked that "allow html formatting" button on the properties bar

    but it still inserts those tags. What am I doing wrong?

    in the attached example, you should see the problem demonstrated - if you click on the button, it traces the value of the input text box. I would like that to be simply "hello" without all the html tags.

    Thanks!
    Attached Files Attached Files

  2. #2
    I tried your file and it indeed traces HTML formatting.

    Use "input_txt.text" (input_txt being the name of your input textfield) instead of the VAR property - it doesn't return any HTML formatting.

  3. #3
    AKA [ Paul Bainbridge] webdreamer's Avatar
    Join Date
    Aug 2001
    Location
    Glasgow, Scotland, UK
    Posts
    3,320
    use instance name instead of the var input
    then you could do
    code:

    trace(box.text)



    that should return unformatted text.
    .: To me AS is like LEGO, Only for the big Kids :.
    - Site - Blog - Twitter - Linkedin
    bringmadeleinehome.com

  4. #4
    Senior Member Lyra's Avatar
    Join Date
    Oct 2001
    Location
    South Africa
    Posts
    243
    OK - cool thanks that works. But why does this only happen sometimes? For example, the attached example does not have the same problem even though I am not using the instance name?
    Attached Files Attached Files

  5. #5
    AKA [ Paul Bainbridge] webdreamer's Avatar
    Join Date
    Aug 2001
    Location
    Glasgow, Scotland, UK
    Posts
    3,320
    you most probably set the html properties fot the textfield to true.
    check the docs about the textfield properties tab
    .: To me AS is like LEGO, Only for the big Kids :.
    - Site - Blog - Twitter - Linkedin
    bringmadeleinehome.com

  6. #6
    Senior Member Lyra's Avatar
    Join Date
    Oct 2001
    Location
    South Africa
    Posts
    243
    Is it possible to set the html property as true without using actionscript? (that is, by selecting something on the Properties bar etc) Because there is no script setting it as true. And I did not select that "allow html formatting" button.

  7. #7
    In the properties panel, to the left of the 'Var' input box, there're three icons - the middle one's 'Render text as HTML'.

  8. #8
    Senior Member Lyra's Avatar
    Join Date
    Oct 2001
    Location
    South Africa
    Posts
    243
    Hi funkage - and thanks for your answer. But if your read my posts you will find that I have unchecked that button, because I do not want html formatting. The button is unchecked, but it still inserts html formatting. That is why I posted on this forum, so I'm hoping someone can come up with another answer for me?

  9. #9
    Senior Member Lyra's Avatar
    Join Date
    Oct 2001
    Location
    South Africa
    Posts
    243
    In addition to the above, I would like to understand why the example attached in my first post inserts html formatting, while the example I attached in my second post does not. I cannot see any difference between them. I have looked at the documentation and cannot find any help there. Anyone able to shed light on this?

  10. #10
    Frankly, I've no answer to your problem. I experience the same thing. Perhaps, it one of the little quirks that Flash occasionally coughs up.

  11. #11
    Senior Member Lyra's Avatar
    Join Date
    Oct 2001
    Location
    South Africa
    Posts
    243
    Oh no Anyone else have any idea?

  12. #12
    Junior Member
    Join Date
    Oct 2009
    Posts
    1
    EPIC BUMP!!!!

    I was having the same problems described here, flash was adding html formatting automatically into input text boxes I was attempting to use for inputs for calculations. After screaming at my computer for a few minutes (that always helps, right?), i noticed another check box in the properties that was checked for no reason: "Auto kern". Unchecked it, and problem solved.

  13. #13
    Junior Member
    Join Date
    Oct 2009
    Posts
    2
    MAN this problem has been making me apesh.t!

    turns out, if you create a static text box first (which DOES have auto kern turned on), then convert it to input text: even though the marker indicated otherwise, auto kern is still turned on.....at least for when it is outputting the vars

    so what you have to do (i did) is to turn the box back to static then turn auto kern off then back go input

  14. #14
    Junior Member
    Join Date
    Apr 2007
    Posts
    12
    Thanks A LOT for this it was driving me crazy !

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center