How to use p:remotecommand in order to update h:inputText value?

1.6k views Asked by At

I have a problem using p:remoteCommand to update a h:inputText in jsf page (primefaces ver 1.1). ActionListener method is being called fine, but server response does not have new value to update inputText value. here is jsf code:

    <h:inputText id="nationalIdCeo" value="#{InsertPotentianAgencyManagers.ceoNationalId}" />
<p:remoteCommand name="rc_updateNationalIds" immediate="true"
actionListener="#InsertPotentianAgencyManagers.setNationalIds}" update="nationalIdCeo" />
<h:outputLink onclick="rc_updateNationalIds(); return false;" >update NIs</h:outputLink>

and here is backbean related method:

public void setNationalIds(ActionEvent event){
  Integer r = new Random( System.currentTimeMillis() ).nextInt(1000000);
  ceoNationalId = r.toString();
}

public String getCeoNationalId() {
  return ceoNationalId;
}

Also I used firebug to gather more information about response. Here is more information:

<?xml version="1.0" encoding="UTF-8"?>
<partialResponse>
  <components>
    <component>
      <id>form:nationalIdCeo</id>
      <output><![CDATA[<input id="form:nationalIdCeo" name="form:nationalIdCeo" type="text" value="" />]]></output>
    </component>
  </components>
  <state><![CDATA[<input type="hidden" name="javax.faces.ViewState" id="javax.faces.ViewState" value="8EgC7hvJoXWgMHaUZxk5rx66APlnNueyP32ajDxbvc/i5akMf2jX5b2om9fR6WlpZC0i3PIunbrAxQXxMwRdpzSFyU84eV8ygbQsQNq6XkwhToCteAtgw3FDPXnLDGwxTsX9pKGbYknB2FWSo74DqQ==" />]]></state>
  <callbackParams>
    <callbackParam>{"validationFailed":false}</callbackParam>
  </callbackParams>
</partialResponse>

Any solution would be appreciated.

0

There are 0 answers