3 Replies Latest reply on Apr 30, 2012 8:42 AM by trigun

    ModalPanel onshow focus Problem

    trigun

      Hi,

       

      i have a problem setting focus ona input field inside a modalPanel. Im using RF 3.3.3 FINAL. and in Firefox it's working fine...

       

      the madalPanel is included by:

       

      <a4j:region id="panelEdtServerRegion">
            <a4j:include id="incPnlEdtServer" viewId="panelEditServer.xhtml" />
       </a4j:region>
      
      

       

      and i call it on button click:

       

       

      <a4j:commandButton id="editBtn" ajaxSingle="true" reRender="editPanelServer" oncomplete="Richfaces.showModalPanel('editPanelServer')" image="/resources/images/icons/edit.gif" >
           <f:setPropertyActionListener target="#{adminServerManager.selectedServer}" value="#{server}"/>
      </a4j:commandButton>
      
      

       

      <rich:modalPanel id="editPanelServer" autosized="true" styleClass="pServerSel" width="300" 
                                onmaskclick="#{rich:component('editPanelServer')}.hide();" 
                                onshow="#{rich:element('incPnlEdtServer:editServerForm:inputName')}.focus();"
      
      

       

      The focus is set in chrome and firefox but in chrome the input which get's focus will not update its value. All other inputs in the popup get the value of the selected Server.

       

      Any suggestion ? Thanks

        • 1. Re: ModalPanel onshow focus Problem
          trigun

          Think it has something to do with chrome automatically select the value of the input ... because when i change my onshow to this:

           

          onshow="#{rich:element('incPnlEdtServer:editServerForm:inputName')}.focus();#{rich:element('incPnlEdtServer:editServerForm:inputName')}.select();return false;">

           

          the value in firefox will also not update ...

          • 2. Re: ModalPanel onshow focus Problem
            trigun

            Hm, sry for spaming, but found out that it hast nothing to do with the focus ...

             

            my input which gets the focus looks like:

             

            <h:inputText id="inputName" styleClass="addEdtInput" value="#{adminServerManager.selectedServer.name}"

                                                                                   size="20" valueChangeListener="#{adminServerManager.valueChanged}"

                                                                                   required="true" requiredMessage="#{messages['admin.required.message'] }" >

                                                              <rich:ajaxValidator event="onblur" />

                                                              <f:validateLength maximum="20" />

                                                    </h:inputText>

                                                    <rich:message for="inputName" errorClass="errorReqired" />

             

            found out, when i remove validation and faces message everything works fine ...

            • 3. Re: ModalPanel onshow focus Problem
              trigun