Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    HTML special characters are converted to corresponding symbols for tab title.

    Hi Isomorphic,

    We are using Smart Gwt-5.1
    Browser: Microsoft Edge, IE11, IE10, Google Chrome, Firefox.

    Issue : HTML special characters are converted to corresponding symbols for tab title.

    Ref. SmartGWT URl:http://www.smartclient.com/smartgwt/...s_title_change


    Steps to reproduce:

    (1). Click on tab first.

    (2). Enter "Test" in text box.

    (3). In second tab it is displaying "Test".


    Result:
    "Test" is displaying in tab title.

    Expected result:
    It should display "Test" in second tab.
    As user i want to display html charcter as it.

    I have attached sreen shot and code for your reference.

    Do let me know if any clarifications required.

    Thanks,
    Attached Files

    #2
    Tab.title and other properties marked with type HTMLString allow HTML by design, so that you can do things like add bold text without needing to modify CSS.

    If you want to display the HTML escaped, you'll need to escape it before you pass it as the tab.title attribute.

    Comment


      #3
      Hi,

      Thank you for your reply.

      As per your above reply i called native method for unescaped before passing into tab title. But result is coming same.

      Code :
      unescapeHTML(string);

      public static native String unescapeHTML(String str)/*-{
      return str == null ? null : new $wnd.String(str).unescapeHTML();
      }-*/;

      Please provide sample code for my reference.

      Thanks,

      Comment


        #4
        Hi vnathank,

        you need to use your escapeHTML method, not the unescapeHTML method.

        Best regards
        Blama

        Comment


          #5
          Just to make it official: Blama is correct (thanks Blama!).

          Comment


            #6
            escapeHTML method is not available for tab .Can you suggest where to get this method.

            Comment


              #7
              Hi vnathank,

              first google hit is: http://www.gwtproject.org/javadoc/la...va.lang.String)

              Best regards
              Blama

              Comment


                #8
                After escapeHTML, result is coming "Test" - correct
                But once i set to Tab.setTitle it is displaying as "Test" - incorrect

                Comment


                  #9
                  To end up displayed as ""Test"" when provided as HTML, your string needs to be ""Test"".

                  You might be calling the API wrongly - perhaps you are passing just: "Test"

                  .. if so, you'd need to call htmlEscape() twice.

                  Comment


                    #10
                    I am passing ""Test"" so it is displaying after escapeHTML ""Test"". But i want to display same as i am passing like ""Test"".

                    Thanks,

                    Comment


                      #11
                      Perhaps just show a minimal case. From the text it is not clear whether you are inputting " as well and to which method you are feeding the String.
                      Also, this is the SmartClient Forum, but from your posts I assume you are using SmartGWT?

                      Best regards
                      Blama

                      Comment


                        #12
                        It is working fine now by calling as SafeHtmlUtils.htmlEscape(string) .I was calling native method so after setting into tab it was converting HTML character. Thanks.
                        Last edited by vnathank; 29 Dec 2015, 04:16.

                        Comment

                        Working...
                        X