Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Passing bean property as parameter of a javascript function

 
Dolfino Proteus
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all!

First post on JavaRanch
(but I know and use this site since I've started to program)

Here's the problem...

I've got an iterate tag as:

inside the iterate block there is a link associated with a javascript function, passing some bean property as parameter of the function like:

It is all working correctly, but if the name property (a string object from the server-side) contains an apex (a single quote like ' ) then a js-error occurs. I can understand easily why this happens (after all is a simple syntax error) but I can't figure out how to solve the problem Does someone know a good way?

Thank you all in advance,
Dolfino
 
Lorand Komaromi
Ranch Hand
Posts: 276
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dolfino Proteus wrote:
First post on JavaRanch


Welcome!

Dolfino Proteus wrote:
but I can't figure out how to solve the problem


If filter="true" doesn't help in the bean:write tag, you could escape the apexes in your action.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic