3 Replies Latest reply on Aug 5, 2010 7:34 AM by Ilya Shaikovsky

    many commandButtons x ENTER key

    Edilmar Alves Expert

      Hi,

       

      I have a webapp with JSF2 + RichFaces 3.3.3.

      There is a CRUD with buttons List, Insert, Remove, Save and Cancel + fields to fill.

      When the user types some information in a field + ENTER, the first a4j:commandButton List is executed.

      I would like disable this behaviour, I dont want to use ENTER to this. Is there some way?

        • 1. Re: many commandButtons x ENTER key
          Ilya Shaikovsky Master

          use hotKey component to prevent default Enter (key=return) behavior.

          • 2. Re: many commandButtons x ENTER key
            Edilmar Alves Expert

            Hi,

             

            I look at sample codes from livedemo for hotkey, all running fine in my Firefox.

            However, when I try to implement something seemed in my webapp, the hotkey doesn't work.

            Below is part of my xhtml file:

             

            <rich:panel style="width:100%;">
              <f:facet name="header">
                 <h:outputText value="Cadastro de Auditorias"/>
              </f:facet>
              <div id="fields">
                <rich:tabPanel id="tabPanelMestre" name="tabPanelMestre" switchType="server">
                  <rich:tab id="tabMD0" name="tabMD0" label="1. Auditoria" disabled="false" reRender="messages">
                    <h:form id="formauditoria">
                      <a4j:commandButton id="listauditoria" image="/imagens/listarmacro.gif"

                        action="#{auditoria.getLst}" immediate="true" title="#{msgBotoes['labelListar']} - Alt+Shift+L"

                        accesskey="l" rendered="#{!auditoria.detalhe}"/>
                       <rich:hotKey key="ctrl+l" handler="#{rich:element('listauditoria')}.click()"/>

            ...

             

            I have used accesskey because hotKey doesn't work.

            If I use "ctrl+l", Firefox understands it has to select all the URL.

            If I use "ctrl+up", like Live Demo sample, none occurs.

            If I delete code for accesskey, living only hotKey, none occurs.