1 Reply Latest reply on May 14, 2007 6:39 PM by Jose de Castro

    A4J - Can I refresh a components value without applying the

    Jose de Castro Newbie

      I'm knee deep in some Seam/A4J fun and have hit a road block. Is it possible to have A4J refresh the value of a component without going through Apply Request Values?

      The attached code demonstrates what I'm trying to accomplish. I'd like to see changes (made outside this form in a different browser) to a person's Manager ID by clicking the the refresh button (cmdRefresh). In a typical web application, I would just have my users refresh the page to view changes but since it's AJAX, I'm essentially looking for is a way to mark a component as read-only for a given AJAX request.

      Does this even make sense?

      <h:form id="DummyForm">
       <h:selectOneMenu id="lstDestination" value="#{BackingBean.managerId}" >
       <f:selectItems value="#{Util.selectItems}" />
       <a4j:commandButton id="cmdRefresh" value="Refresh" reRender="lstDestination" />
       <a4j:commandButton id="cmdSave" value="Refresh" actionListener="#{BackingBean.save}" />
      public class Person {
       private String name;
       private String phone;
       private Long managerId;
       public Long getManagerId() {
       return managerId;
       public void setManagerId(Long managerId) {
       this.managerId = managerId;
      public class BackingBean {
       Person person;
       public void setManagerId(Long managerId) {
       public Long getManagerId() {
       return this.person.getManagerId();

        • 1. Re: A4J - Can I refresh a components value without applying
          Jose de Castro Newbie

          Here is the solution I came up with. The magic is in jsFunction's "bypassUpdates" attribute.

          <a4j:commandButton id="cmdRefresh" value="Refresh" reRender="lstDestination" />


          <input type="button" value="refresh" onclick="getManagerId()" />
          <a4j:jsFunction name="getManagerId"
           function refreshManager(data) {
           document.forms[0].lstDestination.value = data;

          I hope this helps someone :)