Forum: Ruby on Rails Adding a title to an AJAX link.

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
C728d93eb5205cf20cac0c2928b0ad62?d=identicon&s=25 Jeff Jones (rurounijones)
on 2006-04-13 16:19
Hello all.

I am trying to add a title to a link_to_remote created AJAX link.

What I want to create is:

<a href="#" title="VALUE-HERE" onclick="new Ajax.Updater('content',
'/area/show/28/40', {asynchronous:true, evalScripts:true}); return
false;">Area Name</a>

However I cannot seem to get it to work, the API says that
link_to_remote is

link_to_remote(name, options = {}, html_options = {})

If I try:

<%= link_to_remote area.name, :update => 'content', :title => area.name,
:url => { :controller => 'area', :action => 'show', :client_id =>
area.client_id, :id => area.id } -%>

Then the title isn't created. if I try anything else (Putting the :title
and :url inside a pair of curly brackets for example):

<%= link_to_remote area.name, :update => 'content', { :title =>
area.name, :url => { :controller => 'area', :action => 'show',
:client_id => area.client_id, :id => area.id } } -%>

Then I get syntax errors. Could anyone give me the syntax required to
get the above html?

Thanks

Jeff
A2c85dc5ee81b12e3cc0a6522e8d079d?d=identicon&s=25 Chris Hall (Guest)
on 2006-04-13 17:07
(Received via mailing list)
link_to_remote( area.name, { :update => "content", :url => { ... } }, {
:title => area.name } )

name: first argument (this becomes the text between the anchor tags)
options: second argument, a hash of the method options
html_options: third argument, a hash of html attributes
This topic is locked and can not be replied to.