Page 1 of 1

Variable tooltip for JForm field

Posted: Mon Apr 15, 2019 12:21 pm
by MarkRS
I want to set an input field's tooltip from data.

I can do it easily enough when I code the html output myself in (eg) <view>/tmpl/default.php but I can't seem to do it with data loaded from an XML form.

I'd hoped

Code: Select all

		$this->form->setFieldAttribute($fieldname, 'description', $value);
would do it, but this sets the tooltip of the field label, not the field itself.

Is there a way to do this?

Re: Variable tooltip for JForm field

Posted: Wed May 01, 2019 9:43 am
by paulala
You could use some page specific JS to set the tooltip of the parent at load or at any other time after if necessary.

Re: Variable tooltip for JForm field

Posted: Wed May 01, 2019 8:46 pm
by MarkRS
Thanks Paula. I might have to do that, I'd hoped not though

Re: Variable tooltip for JForm field

Posted: Thu May 02, 2019 7:39 am
by SharkyKZ
"description" attribute is generally used for labels. Inputs normally do not have tooltips. What type of field are you using?

Re: Variable tooltip for JForm field

Posted: Thu May 02, 2019 10:49 am
by MarkRS
I'm not very good at "normal" :)

It's only a normal (ooops) text field. I was going to use the tooltip to show the translated text for the page's selected "alternate" language. However, somewhat to my surprise, the translation functionality looks very usable by extension writers so I think that's the way I'll go.