Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8541109
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T11:45:19+00:00 2026-06-11T11:45:19+00:00

I want to know what is the suitable replacement for this line. this.__LZtextclip.text I

  • 0

I want to know what is the suitable replacement for this line.

this.__LZtextclip.text

I am using this to get the string present in the text node. This works fine in Openlaszlo 3.3 but in 4.9 and 5.0 it’s giving a problem

I tried updating it to

this.sprite.__LZtextclip.text

And i am getting an error:

79: Error: Access of possibly undefined property __LZtextclip through a reference with static type LzSprite, in line: Debug.write(this.sprite.__LZtextclip.text);

Any idea why this problem is happening?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T11:45:20+00:00Added an answer on June 11, 2026 at 11:45 am

    If you are trying to access the text content of a text field, why don’t you just access the attribute text?

    <canvas> 
    
        <text name="sample" id="gRead" />
    
        <handler name="oninit">
          gRead.setAttribute('text',"HI");
          Debug.info(gRead.text);
        </handler>
    
    </canvas>
    

    In OpenLaszlo 3.3 there is method getText(), which gives you the same value. Accessing mx.textfield in your code does not work for the DHTML runtime.

    Edit: Added information regarding the stripping of HTML tags
    The Flash Textfield class flash.text.Textfield provides an API to enable HTML tag content in a Textfield instance. There are two different properties, one called text, the other one htmlText. If you want to directly access the Flash Textfield object of an lz.text instance, it’s a property of the display object of the lz.text instance:

    // Flash Textfield instance
    gRead.getDisplayObject().textfield
    // Pure text content
    gRead.getDisplayObject().textfield.text
    // Formatted text
    gRead.getDisplayObject().textfield.htmlText
    

    You should be aware of the fact that Flash automatically adds HTML format to any textstring you set as content. When you do

    gRead.setAttribute('text',"HI");
    

    the textfield.htmlText value is

    <P ALIGN="LEFT"><FONT FACE="Verdana" SIZE="11" COLOR="#000000" LETTERSPACING="0" KERNING="1">HI</FONT></P> 
    

    For the DHTML runtime, the text content is added as the innerHTML of a <div> tag, and there is no standardized API to retrieve the pure text content of a DOM structure for a tag with content. You could write your own function to extract the text content, or use JavaScript functions from existing frameworks – like the jQuery text() function – to achieve the same result for the DHTML runtime.

    I guess the reason is that Laszlo started using the Dojo based rich text editor for text input with HTML formatting since OpenLaszlo 4.0 or 4.1.

    The best approach to have consistent behavior across runtimes when stripping tags is to do the conversion on the server-side. That’s especially needed if you wan to have consistent whitespace treatment in multiline text, since there differences in how browsers treat whitespace. The question how to best strip tags from strings in JavaScript has been answered before on Stackoverflow, e.g. JavaScript: How to strip HTML tags from string?

    Here is a cross-runtime example which works in DHTML with Firefox, Chrome, and it should work with IE9+:

    <canvas> 
    
        <text name="sample" id="gRead" />
    
        <handler name="oninit"><![CDATA[
          gRead.setAttribute("text", 'Hello <b>World</b> <a href="http://www.openlaszlo.org">OL</a>');
          Debug.info("gRead.text=" + gRead.text);
          if ($dhtml) {
            Debug.info(gRead.getDisplayObject().textContent);
          } else {
            Debug.info(gRead.getDisplayObject().textfield.text);
          }
        ]]></handler>
    
    </canvas>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

want to know why String behaves like value type while using ==. String s1
i want know if is possible, to get a specific element value of a
i want to know is there anyway that using Java one can capture the
I know that this question was asked earlier but the OP didn't get any
I want to trigger this jquery function by using trigger method of JQuery. How
I want to know that which JDBC driver is suitable for Java 7 i.e.
i want know how i can manage multiple twitter account on iOS in my
please help me. I want know about what types of flags to run an
I have an android app it displays web view.I want know the app idle
I'm making a chat responder for a game and i want know if there

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.