Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #10529 > unrolled thread
| Started by | Bhushan Kakulte <b.kakulte@gmail.com> |
|---|---|
| First post | 2012-01-23 23:18 -0800 |
| Last post | 2012-01-24 17:32 +0100 |
| Articles | 3 — 3 participants |
Back to article view | Back to comp.lang.javascript
Unterminated String constant error Bhushan Kakulte <b.kakulte@gmail.com> - 2012-01-23 23:18 -0800
Re: Unterminated String constant error Erwin Moller <erwinmollerusenet@xs4all.nl> - 2012-01-24 10:35 +0100
Re: Unterminated String constant error Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2012-01-24 17:32 +0100
| From | Bhushan Kakulte <b.kakulte@gmail.com> |
|---|---|
| Date | 2012-01-23 23:18 -0800 |
| Subject | Unterminated String constant error |
| Message-ID | <db47ff6a-ac18-4549-b606-6916cf338c90@i18g2000yqf.googlegroups.com> |
Hi, I have content from textarea which contains newline character also. I am storing this data in database. <textarea id="text1">unknown data</textarea> I extract the data (textarea value) we stored in database. When I tried to use this content in table it gives string unterminated constant error. consider val1=text1.value <table> <tr> <td title=val1> </td> </tr> </table> Please tell me how to handle newline character from textarea. Thanks, Bhushan
[toc] | [next] | [standalone]
| From | Erwin Moller <erwinmollerusenet@xs4all.nl> |
|---|---|
| Date | 2012-01-24 10:35 +0100 |
| Message-ID | <4f1e7b4f$0$6880$e4fe514c@news2.news.xs4all.nl> |
| In reply to | #10529 |
On 1/24/2012 8:18 AM, Bhushan Kakulte wrote: > Hi, > > I have content from textarea which contains newline character also. I > am storing this data in database. > <textarea id="text1">unknown > data</textarea> First check: Did that work alright? Is the data actually stored in the database? > > I extract the data (textarea value) we stored in database. When I > tried to use this content in table it gives string unterminated > constant error. > consider val1=text1.value What has "val1=text1.value" to do with the data you took out of the database? I would expect you have some data stored in some serverside variable. You above example (val1=text1.value) is Javascript (sort of). > <table> > <tr> > <td title=val1> </td> That makes no sense at all. Please explain what you are trying to do. If you want the title of that <td> to hold information from the database you should do something like this: [PHP example] <td title="<?php echo $myTitle; ?>">...</td> Mind the "". Also make sure $myTitle is appropriately escaped. When the raw data for title contains " you get into trouble when you don't escape. > </tr> > </table> > > Please tell me how to handle newline character from textarea. > What do you want to do with the data from the textarea? You question is impossible to answer without such context. It is like you ask me: "What must I do with this 10 dollar note?". Give some context, and people can help you better. > Thanks, > Bhushan Regards, Erwin Moller -- "That which can be asserted without evidence, can be dismissed without evidence." -- Christopher Hitchens
[toc] | [prev] | [next] | [standalone]
| From | Thomas 'PointedEars' Lahn <PointedEars@web.de> |
|---|---|
| Date | 2012-01-24 17:32 +0100 |
| Message-ID | <1934714.aqSPkdTlGX@PointedEars.de> |
| In reply to | #10530 |
Erwin Moller wrote:
> If you want the title of that <td> to hold information from the database
> you should do something like this:
> [PHP example]
>
> <td title="<?php echo $myTitle; ?>">...</td>
>
> Mind the "".
> Also make sure $myTitle is appropriately escaped.
Like
<?php echo htmlspecialchars($myTitle, ENT_COMPAT, $encoding); ?>
> When the raw data for title contains "
or `<' and `&'.
> you get into trouble when you don't escape.
ACK.
PointedEars
--
realism: HTML 4.01 Strict
evangelism: XHTML 1.0 Strict
madness: XHTML 1.1 as application/xhtml+xml
-- Bjoern Hoehrmann
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.javascript
csiph-web