Mixing onlick functions in link_to_function

Hi:

This is giving an error:

<%= link_to_function “expand”,
“Element.toggle(‘in#{msg.id}’);
Element.show(‘col#{msg.id}’); Element.hide(‘ex#{msg.id}’);
document.getElementById(’#{msg.id}’).style.backgroundColor = ‘white’;
{new Ajax.Request(’/messages/msg_read/#{msg.id}, {asynchronous:true,
evalScripts:true})}” %>

I’ve tried it a bunch of different ways but I still get an:

“unterminated string literal”

error.

Any help you can provide would be greatly appreciated - or Is there a
better way?

Thanks!

Mike

Mike D. wrote:

Hi:

This is giving an error:

<%= link_to_function “expand”,
"Element.toggle(‘in#{msg.id}’);
Element.show(‘col#{msg.id}’); Element.hide(‘ex#{msg.id}’);
document.getElementById(’#{msg.id}’).style.backgroundColor = ‘white’;
{new Ajax.Request(’/messages/msg_read/#{msg.id}, {asynchronous:true,
--------------------^

This quote mark isn’t closed.

On Jun 2, 2007, at 4:03 PM, Mike D. wrote:

Mike

<%= link_to_function “expand” do |page|
page.toggle “in#{msg.id}”
page.show “col#{msg.id}”
page.hide “ex#{msg.id}”
page << “$(’#{msg.id}’).style.backgroundColor = ‘white’;”
remote_function(:url => ‘/messages/msg_read/#
{msg.id}’) #<<== messages_msg_read_path(msg) perhaps?
end %>

gives:

expand

Which is clearly easier to read (and find that missing ’ that Alex
pointed out), right?

-Rob

Rob B. http://agileconsultingllc.com
[email protected]

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs