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

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Matt Mueller (Guest)
on 2007-02-02 19: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 there some way to
just append an html value (i.e. tooltiptext=x) to the text field call?
Or another workaround?

Thanks in advance.
Chris H. (Guest)
on 2007-02-02 20: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.
Matt Mueller (Guest)
on 2007-02-02 22:01
No, I am talking about a homemade solution.  So title and alt attributes
won't work.
Chris H. (Guest)
on 2007-02-02 23: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.