Briefkasten
Briefkasten

Reputation: 1994

Hide inputText on lost focus with p:inplace

my form looks like that:

        <p:inplace>  
            <h:inputText id="description" value="#{cc.attrs.description}" /> 
        </p:inplace> 

When the user clicks into the Text of the p:inplace the inputText will be shown to edit the value.

How can I hide the inputText or the p:inplace when the user clicks somewhere else or the control it self lose the focus.

Thanks.

Upvotes: 1

Views: 2012

Answers (1)

Aritz
Aritz

Reputation: 31649

Use the blur event over the inputText, passing an id value to it:

<p:inplace widgetVar="basic_#{cc.id}">
    <p:inputText value="#{cc.attrs.description}" id="description">
        <p:ajax event="blur" oncomplete="basic_#{cc.id}.hide();" />
    </p:inputText>
</p:inplace>

Upvotes: 2

Related Questions