File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes HTML, CSS and JavaScript and the fly likes Javascript error Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Javascript error "Expected Watch "Javascript error "Expected New topic
Author

Javascript error "Expected ')' " on rendering the page.

anjanayya myathri
Greenhorn

Joined: Apr 21, 2013
Posts: 3

Hi, am getting an js error due to break of the page while rendering the page.

Am getting error at below statement
<input type="radio" name="something" value="something1" onclick="method1(<cut value='${iter.value1} />' , '<cut value='${iter.value2}' /> ', <cut value='${iter.value3}'/> );"

In second parameter if the value has apostrophe character, then we are getting the error.
Am not able to escape it as it is written in the tags:
can you please help me out here.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61766
    
  67

That is JSP source. What we need to see is the rendered HTML at the browser. Do a View Source to see what's been sent to the browser.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
anjanayya myathri
Greenhorn

Joined: Apr 21, 2013
Posts: 3

view source has been disabled on the page. any other suggestions...?
bala nannaka
Ranch Hand

Joined: Apr 02, 2007
Posts: 49
All the latest browsers are equipped with developer friendly tools. just click f12 and verify in the console.you can test and modify the js code from your console try it
anjanayya myathri
Greenhorn

Joined: Apr 21, 2013
Posts: 3

Its a pop-up window with special previleges, so they have disabled almost all the functionalities for it.
Is ter any replacement for <c: out value="${iter.description}"/> statement. ?
bala nannaka
Ranch Hand

Joined: Apr 02, 2007
Posts: 49
Then you need to escape the html characters from serverside so that apostrophe will not break the js
Jeanne Boyarsky
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 31070
    
232

OWASP provides an Encoder API where you can escape for various languages including JavaScript.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Javascript error "Expected ')' " on rendering the page.