Search code examples
jsfajax4jsf

a4j:support after h:inputText value change doesn't work


can anyone figure out why the h:outputText doesn't get refreshed after inputText value change? I've tried both onkeyup and onchange and both don't affect..

When I do some other thing that makes the page refresh, the h:outputText is rendered correctly so it's only a matter of getting the ajax to actually rerender the component.

<h:inputText autocomplete="off" styleClass="propertyInput"
    value="#{activesyncDM.userNameDomain}" validator="#{activesyncDM.validate}"
    id="userNameDomain" dir="ltr">
    <a4j:support event="onkeyup" reRender="domainNameSlash"/>
</h:inputText>
<h:outputText id="domainNameSlash" value="\\"  rendered="#{!empty activesyncDM.userNameDomain}"/>

Thanks!!


Solution

  • besides putting ajaxSingle="true" for a4j:support which is mentioned by Cristian , the id attribute in HTML code rendered by the JSF may not be the same as the ID value you set in <h:outputText> . Richfaces provides a function rich:clientId('id') to get these dynamic ID generated by JSF . This function is invoked via the EL expression.

    So , you can try :

    <a4j:support event="onkeyup" ajaxSingle="true" reRender="#{rich:clientId('domainNameSlash')}"/>