Jordi
2007-Mar-29 03:30 UTC
page.insert_html of link_to_function return value. Problems with escaping.
Hi folks. I''m trying to do this:
a_link = link_to_function(''say_hello'') do |page|
page.alert(''hello'')
end
@another_link = link_to_function(''add_link_to_some_div'') do
|page|
page.insert_html(:bottom, :some_div, a_link)
end
Then I print "@another_link" on the view. When I click on it,
"a_link"
is not inserted on "some_div". If, however, I change
"a_link" to be
"white elephant", it gets added just fine. If I change the first three
lines (from the code above) to:
a_link = link_to_function(''say_hello'') do |page|
page.alert(nil)
end
Then "a_link" gets inserted to "some_div" correctly, and
when I click
on it, I get a Js alert box. The minute I put the single quotes, it
does not get inserted.
What gives? Any ideas?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Spinoffs" group.
To post to this group, send email to
rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---