• Post Reply Bookmark Topic Watch Topic
  • New Topic

enter key creats problem on JSP  RSS feed

 
suchit pandya
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

i am facing problem with enter key . I have an image and i call a finction on onclick event. In this function a value prviously stored in database is being passed as argument(value is text content).
but when i get enter key in text content it gives unterminated string constant.



Thanks in advance
 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Post the HTML that gets generated by that JSP snippet. My guess would be that the value of WSR_ATTR1_VAL contains unescaped single or double quotes.
 
suchit pandya
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


it is coming like this in view source.
because on \n "ff"goes in new line.

can we decode encode \n by any escape character or any there way??
 
suchit pandya
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for posting i solved it.

by replacing \r\n of the string by /r and then re replace /r by \r\n in called function.
 
salvin francis
Bartender
Posts: 1612
36
Eclipse IDE Google Web Toolkit Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
suchit pandya wrote:Thanks for posting i solved it.

by replacing \r\n of the string by /r and then re replace /r by \r\n in called function.


I suggest a different way would be to convert:

\r\n to \\r\\n

which will make the output:
<td width="5%" align="center" class='label3'>

<img src="/IWAS/FMS/images/vwicn116.gif" onclick="showComments('no comments\r\nff');">

I wonder if \r makes sense in js though...
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!