0 Replies Latest reply on May 26, 2011 2:27 AM by Muthu Kumaran

    Richfaces input text focus isssue IE

    Muthu Kumaran Newbie

      Hi,

       

      We are facing the focus while reRendering text box in IE.

       

      Xhtml:

      <html>

          <head>

              Test Text

      </head>

          <body>

              <div xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets"

                  xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html"

                  xmlns:a4j="http://richfaces.org/a4j" xmlns:rich="http://richfaces.org/rich">

                  <h:form id="form1">

                      <a4j:outputPanel id="PageARoot">

                          <a4j:keepAlive beanName="simpleBean" />

                          <h:outputText value="Infants:" />

                          <h:inputText id="text1" value="#{simpleBean.size}">

                              <a4j:support event="onblur" action="#{simpleBean.action}"

                                  oncomplete="document.getElementById('form1:list:0:text2').focus();"

                                  reRender="MyContent" />

                          </h:inputText>

                          <h:panelGroup id="MyContent">

                              Ages:

                              <a4j:repeat id="list" value="#{simpleBean.list}" var="item">

                                  <h:inputText id="text2" value="#{item}"

                                      onblur="javascript: alert(this.id);" />

                              </a4j:repeat>

                          </h:panelGroup>

                      </a4j:outputPanel>

                  </h:form>

              </div>

          </body>

      </html>

      Bean Code:

      package beans;

       

      import java.util.ArrayList;

      import java.util.List;

       

      import javax.annotation.PostConstruct;

       

      public class SimpleStringBean {

       

          private List list;

          public List getList() {

              return list;

          }

       

          public void setList(List list) {

              this.list = list;

          }

          private int size;

          public int getSize() {

              return size;

          }

       

          public void setSize(int size) {

              this.size = size;

          }

       

          @PostConstruct

          public void initialize(){

              System.out.println("Initalize");

              list = new ArrayList();

              list.add(new Long(0));

              size = 1;

          }

          private String text;

       

          public String getText() {

              return text;

          }

       

          public void setText(String text) {

              this.text = text;

          }

         

          public void action(){

              System.out.println("Action: " + text);

              list = new ArrayList();

              for(int i = 0; i < size; i++){

                  list.add(new Integer(0));

              }

          }

         

      }

       

      Faces-config.xml:

      <managed-bean>


      <managed-bean-name>simpleBean</managed-bean-name>


      <managed-bean-class>beans.SimpleStringBean</managed-bean-class>


      <managed-bean-scope>request</managed-bean-scope>

      </managed-bean>

       

      When i tab out of the input text box "text1", the panel group is getting rerendered, but the focus is not setting to next input box. But i press on tab again, text2's onblur event is getting called. Which means the focus is set to one of the textbox, but focus is not visible or i am not able to type anything.

       

      Please help on this issue..