Alina Danila
Alina Danila

Reputation: 1683

richfaces tooltip for inputtext

I want to have a tooltip for an inputtext and I need the tooltip to be updated when I complete the inputtext. I place this elements inside a form.

The inputtext takes the value from a backing bean, and the value is set in the bean only when I submit the form. Yhe tooltip also takes the value from the bean.\

Here is some code I use (of course, it is not working):

<h:inputText id="inp" value="#{individual.givenName}">
    <a4j:support event="onchange" reRender="inp" />
</h:inputText>
<rich:toolTip id="inp_tip">#{individual.givenName}</rich:toolTip>

I want the tooltip to be updated when I type some text. Any idea how I can do this?

Thanks!

Upvotes: 0

Views: 4390

Answers (1)

Mike Bockus
Mike Bockus

Reputation: 2079

You can get the tooltip updated by implementing something like this:

<a4j:region id="a4jRegion">
    <h:panelGroup layout="block" id="divTooltipInputText">
    <h:inputText id="inp" value="#{individual.givenName}">
        <a4j:support event="onchange" reRender="divTooltipInputText" />
    </h:inputText>
    <rich:toolTip for="inp" id="inp_tip">#{individual.givenName}</rich:toolTip>
    </h:panelGroup>
</a4j:region>

The a4j:region will limit the processing on the onchange event to just the inputText and toolTip.

Upvotes: 4

Related Questions