lulu50
asked on
how can I pass a string with apostrophe
Hi,
I need your help please, I have an onclick event that I am passing a variable.
the value of that variable has apostrophe. How can I pass my value with apostrophe in it?
here's what I have
I need your help please, I have an onclick event that I am passing a variable.
the value of that variable has apostrophe. How can I pass my value with apostrophe in it?
here's what I have
the value for "cn" is = 'O'brianes'
onClick="return SendValue('#UrlVal#');">
so this is how it looks
onClick="return SendValue('O'brianes');">
How can I fix this issue?
Please help thank you
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
I suggest you use double quotes:
onClick="return SendValue(\"#UrlVal#\");">
onClick="return SendValue(\"#UrlVal#\");">
looks like I confused the "html/url" part ...
you may want to try eval...
onClick="return SendValue(eval('GetSomeUse rs.cn') )">
anyhow, where does the value come from?
you may want to try eval...
onClick="return SendValue(eval('GetSomeUse
anyhow, where does the value come from?
using double quotes will not help if the value contains double quotes...
ASKER
I tried double quotes and that did not work
the value coming from the database
the value coming from the database
ASKER
How can I in Javascript
make this value :
onClick="return SendValue('#GetSomeUsers.c n#' )"
turn to this value:
O\'brianes
if I replace ' with \' then it will work (How can I do the replace in javascript)
onClick="return SendValue('#GetSomeUsers.c n#.replace (/'/g, "")' )"
something like the above syntax
make this value :
onClick="return SendValue('#GetSomeUsers.c
turn to this value:
O\'brianes
if I replace ' with \' then it will work (How can I do the replace in javascript)
onClick="return SendValue('#GetSomeUsers.c
something like the above syntax
ASKER
if I do this then it works
onClick="return SendValue('O\'brianes')
so I need to replace ' with \' in order to work with my passed variable #GetSomeUsers.cn#
onClick="return SendValue('O\'brianes')
so I need to replace ' with \' in order to work with my passed variable #GetSomeUsers.cn#
ASKER
#REReplace(GetSomeUsers.cn ,"''","'", "ALL")#
but I need to add the \ to get to this result O\'brianes I don't know where to put the \
but I need to add the \ to get to this result O\'brianes I don't know where to put the \
ASKER
oh I got it
ASKER
Thank you Guy for telling that I have to put \ when I did it works fine
onClick="return SendValue('#REreplace(GetS omeUsers.c n, "'", "\'", "all")#')
onClick="return SendValue('#REreplace(GetS
ASKER
Thank you all for your help
ASKER
Open in new window