Forum: Ruby on Rails How to add extra value to form?

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.
C0bc3250b28a1b33333bebe05e358d24?d=identicon&s=25 Matt Mueller (Guest)
on 2007-02-02 18:24
Ok, I am a total n00b when it comes to this stuff, but am working as a
designer on a project built on ror.  Here's my question.

I want to add js tooltips to pop up when a form field is focused on.
This is easy enough...have the script running, works fine.  The problem
is, how do I add the necessary value (tooltiptext) into the form field.

For example, I would like to do something like this: <%= text_field
'person', 'name', :class => 'formtext' , :tooltiptext = > 'This is the
text' %>

But obviously ror doesn't understand tooltiptext...is there some way to
just append an html value (i.e. tooltiptext=x) to the text field call?
Or another workaround?

Thanks in advance.
A2c85dc5ee81b12e3cc0a6522e8d079d?d=identicon&s=25 Chris Hall (au5lander)
on 2007-02-02 19:11
(Received via mailing list)
are you taking about the off-yellow box that the browser shows you
when you mouse over something? or are you talking about a homemade
tooltip solution?

if it's the first, it is the 'title' attribute, so you would want to
do :title => 'look at me!' in the html options for the tag.  however,
i believe IE will show you the alt attribute, so if you do both :alt
and :title, you should be safe.
C0bc3250b28a1b33333bebe05e358d24?d=identicon&s=25 Matt Mueller (Guest)
on 2007-02-02 21:01
No, I am talking about a homemade solution.  So title and alt attributes
won't work.
A2c85dc5ee81b12e3cc0a6522e8d079d?d=identicon&s=25 Chris Hall (au5lander)
on 2007-02-02 22:05
(Received via mailing list)
well then you are going to have to rely on using the element events to
show/hide your tooltips

something like:

<%= text_field ..., :onfocus => "show_tooltip(...)", :onblur =>
"hide_tooltip(...)" %>

i don't know how you are implementing your tooltips so i can't really
provide more than that.
This topic is locked and can not be replied to.