Link_to onclick -javascript call

Hello All,
I have a link_to function for a link as follows

<%=link_to “Reply” ,{},:href=>"#",:class => “replyMessage
noBackgroundImage” ,:title =>“Click here to reply”,:onclick =>
“popup(‘popUpDiv_reply’);showName(’<%= h message.chid
%>’,‘channeltopost’);”%>

When I try to run the file with the onclick as defined above,I get the
following error
syntax error, unexpected tRPAREN

Is there a way to fix it?

Thanks in Advance

Regards
Chandrika

What does the generated source code look like? I’m guessing the value of
“message.chid” might be messing up the HTML.

Also, have you considered using “link_to_function” instead of using
“link_to”. Might clean up your code a little bit.*
*

Phil

On Thu, Mar 10, 2011 at 5:22 AM, Chandu80 [email protected]
wrote:

Hello All,
I have a link_to function for a link as follows

<%=link_to “Reply” ,{},:href=>“#”,:class => “replyMessage
noBackgroundImage” ,:title =>“Click here to reply”,:onclick =>
“popup(‘popUpDiv_reply’);showName(‘<%= h message.chid
%>’,‘channeltopost’);”%>

You don’t need to (and probably can’t) nest erb tags <% %>… in your
onclick, you could just do:

:onclick => “popup(‘popUpDiv_reply’);showName(‘#{h
message.chid}’,‘channeltopost’);”

Hi Tim,
Sorry for the late reply.
Yes the message.chid was causing the problem.
Thanks for the response.

Regards
Chandrika