[CLOSED] Unterminated string constant

  1. #1

    [CLOSED] Unterminated string constant

    Hi there,

    If I use an ext:textarea and populate it with some text from a database that has newlines in it, I get 'Unterminated string constant'.

    'I think' this happens when coolite builds the page... I can see it falling over on this part:



    this.SiteCommentsTextArea.setRawValue("blah blah blah
    
    blah blah
    
    blah blah blah
    
    ");
  2. #2

    RE: [CLOSED] Unterminated string constant

    What version of Coolite are you using? I had the same problem but they fixed it for me in SVN.

    Cheers,
    Timothy
  3. #3

    RE: [CLOSED] Unterminated string constant

    Link to similar problem with double quotes; should now be encoded:

    Cheers,
    Timothy
  4. #4

    RE: [CLOSED] Unterminated string constant

    Hi t0ny,

    As mentioned by Timothy, in the next version we've enquote'd the .Text value. Now characters like "\\n" and "\r" are automatically converted to "\\\\n" and "\\r".

    EDIT: It looks like the current <ext:HtmlEditor> is also having problems escaping the "slash-n" newline character. I've tested the v0.6 release and everything appears to work properly.

    You should be able to do a string.Replace on the string value coming from the database before setting the .Text property and replace instance of "\\n" and "\r" with "\\\\n" and "\\r".

    Hope this helps.
    Geoffrey McGill
    Founder
  5. #5

    RE: [CLOSED] Unterminated string constant

    I forgot to post a sample I was testing with.

    Example

    <%@ Page Language="C#" %>
    
    <%@ Register assembly="Coolite.Ext.Web" namespace="Coolite.Ext.Web" tagprefix="ext" %>
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    
    <script runat="server">
        protected void Page_Load(object sender, EventArgs e)
        {
            this.TextArea1.Text = @"blah blah blah
    blah blah
    
    blah blah blah
    ";
        }
        
        protected void Button1_Click(object sender, EventArgs e)
        {
            this.TextArea2.Text = this.TextArea1.Text;
        }
        
        protected void Button2_Click(object sender, EventArgs e)
        {
            this.Label1.Text = this.TextArea2.Text;    
        }
    </script>
    
    <html xmlns="http://www.w3.org/1999/xhtml" >
    <head runat="server">
        <title>TextArea with newline characters</title>
    </head>
    <body>
        <p><a href="NewLines.aspx">Reload</a></p>
        <form id="form1" runat="server">
            <ext:ScriptManager ID="ScriptManager1" runat="server" />
            <p>
                TextArea #1<br />
                <ext:TextArea ID="TextArea1" runat="server" Height="150" Width="300" />
                <ext:Button ID="Button1" runat="server" Text="Move" Icon="ArrowDown" 
                    &#111;nclick="Button1_Click" />
            </p>
            <p>
                TextArea #2<br />
                <ext:TextArea ID="TextArea2" runat="server" Height="150" Width="300" />
                <ext:Button ID="Button2" runat="server" Text="Submit" Icon="Printer" 
                    &#111;nclick="Button2_Click" /> 
    
            </p>
            <asp:Label ID="Label1" runat="server" />
        </form>
    </body>
    </html>
    Hope this helps.
    Geoffrey McGill
    Founder
  6. #6

    RE: [CLOSED] Unterminated string constant

    Yep, that solved the problem. Working between two projects so only just got to look at this.
    Do I need to be subscribed to the professional edition of Coolite to be able to use Toolkit 0.6 SVN?

    If not is this still not recommended?
  7. #7

    RE: [CLOSED] Unterminated string constant

    Hi t0ny,

    Thanks for the update. Glad to hear it's working for you now.

    SVN access is available to all Professional Edition holders with a support subscription. more info. The SVN repository contains the absolutely most recent code (the stuff we're working on right now) and all version history.
    Geoffrey McGill
    Founder
  8. #8

    RE: [CLOSED] Unterminated string constant

    Hi geoffrey,

    There's problem with Html Editor.
    At page_load event am loading Html file to HtmlEditor.
    When i Clear Htmleditor and Loads again on Button-Click event. "unterminated string Constant error comes"

Similar Threads

  1. Replies: 1
    Last Post: Feb 28, 2011, 8:13 AM
  2. Replies: 4
    Last Post: Feb 01, 2011, 11:54 AM
  3. Unterminated string Constant in HTmLEditor
    By designworxz in forum 1.x Help
    Replies: 8
    Last Post: Feb 22, 2009, 11:24 PM
  4. Replies: 3
    Last Post: Nov 12, 2008, 5:16 AM
  5. Unterminated String Constant
    By jlertle in forum 1.x Help
    Replies: 0
    Last Post: Jul 17, 2008, 9:25 PM

Posting Permissions