Jaime Brolesi
Jaime Brolesi

Reputation: 53

remoteCommand and inputMask don't work togheter

I tried to make a address validation, when I set a CEP the system goes to the managed bean, makes a request for a webservice and returns informations about the street, city and state (CEP is a kind of address code). But when I used a remoteCommand with an inputMask component my managed bean doesnt received a information in my object, the cep attribute was null.

I have a managed bean with a @ViewScoped.

<p:remoteCommand name="remoteCep" actionListener="#{empresaTerceiroMB.buscarCep}" process="@this" async="true" update="cep, logradouro, bairro, cidade, estado, mensagens" >
    <p:inputMask id="cep" mask="99999-999" value="#{empresaTerceiroMB.endereco.cep}" title="#{msgs.msgCepEmpresa}" maxlength="8" onblur="remoteCep()" style="width: 90%" />
</p:remoteCommand>

Upvotes: 0

Views: 109

Answers (1)

maress
maress

Reputation: 3533

Well, i have never used remote command in the way you are using it. I am, even unsure if its supposed to have a child component.

The best way to do this would be:

<p:inputMask id="cep" mask="99999-999" value="#{empresaTerceiroMB.endereco.cep}" title="#{msgs.msgCepEmpresa}" maxlength="8" onblur="remoteCep()" style="width: 90%" />
<p:remoteCommand name="remoteCep" actionListener="#{empresaTerceiroMB.buscarCep}" process="cep" async="true" update="cep, logradouro, bairro, cidade, estado, mensagens" />

Upvotes: 1

Related Questions