[SOLVED] Unterminated string constant
*NEW - Coolite Toolkit Version 0.7 now available for DOWNLOAD. See also Examples Explorer.
 

Coolite Forums

Welcome Guest ( Login | Register )
 
[SOLVED] Unterminated string constant
Subscribe
Last Login: Today @ 4:43:23 AM
Posts: 43,
Posted 8/4/2008 5:52:40 AM

Group: Coolite Early Adopter
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

");

Last Login: Today @ 4:23:18 AM
Posts: 648,
Posted 8/4/2008 7:03:47 AM

Group: Coolite Premium Member & Early Adopter
What version of Coolite are you using?  I had the same problem but they fixed it for me in SVN.

Cheers,
Timothy


----
Timothy Grant Vogelsang
tvogelsang [at] gmail [dot] com
Coolite Toolkit 0.7 SVN (Professional Edition)
Microsoft .NET Framework 2.0
Microsoft ASP.NET Ajax 1.0

Last Login: Today @ 4:23:18 AM
Posts: 648,
Posted 8/4/2008 7:05:18 AM

Group: Coolite Premium Member & Early Adopter
Link to similar problem with double quotes; should now be encoded:

Cheers,
Timothy


----
Timothy Grant Vogelsang
tvogelsang [at] gmail [dot] com
Coolite Toolkit 0.7 SVN (Professional Edition)
Microsoft .NET Framework 2.0
Microsoft ASP.NET Ajax 1.0

Last Login: Today @ 5:17:06 AM
Posts: 1,645,
Posted 8/4/2008 7:50:30 AM

Group: Core Development Team
Hi t0ny,

As mentioned by Timothy, in the next version we've enquote'd the .Text value. Now characters like "\" and "\r" are automatically converted to "\\\" 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 "\" and "\r" with "\\\" and "\\r".

Hope this helps.
--
Geoffrey McGill
Coolite Inc.
Development Team
Coolite Examples | Coolite API Docs | ExtJS API Docs
twitter [coolite | personal]
Last Login: Today @ 5:17:06 AM
Posts: 1,645,
Posted 8/4/2008 8:58:08 AM

Group: Core Development Team
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"
                onclick="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"
                onclick="Button2_Click" />

        </p>
        <asp:Label ID="Label1" runat="server" />
    </form>
</body>
</html>


Hope this helps.
--
Geoffrey McGill
Coolite Inc.
Development Team
Coolite Examples | Coolite API Docs | ExtJS API Docs
twitter [coolite | personal]
Last Login: Today @ 4:43:23 AM
Posts: 43,
Posted 8/6/2008 2:39:09 AM

Group: Coolite Early Adopter
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?
Last Login: Today @ 5:17:06 AM
Posts: 1,645,
Posted 8/6/2008 2:45:37 AM

Group: Core Development Team
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
Coolite Inc.
Development Team
Coolite Examples | Coolite API Docs | ExtJS API Docs
twitter [coolite | personal]
« Prev Topic | Next Topic »
Reading This Topic
Active Users: 0 ( 0 guests, 0 members, 0 anonymous members )
No members currently viewing this topic.
All times are GMT -8:00, Time now is 5:18am