Версия для печати темы
Нажмите сюда для просмотра этой темы в оригинальном формате
Форум программистов > Java EE (J2EE) и Spring > JSF Richfaces не работают горячие клавиши


Автор: cuvorov 1.12.2010, 21:33
Есть вот такая вот страничка авторизации.

Код

 <?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns:c="http://java.sun.com/jsp/jstl/core"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:a4j="http://richfaces.org/a4j"
                xmlns:rich="http://richfaces.org/rich"
                >
    <a4j:outputPanel styleClass="centered">
        <h:panelGrid id="panelLogin" columns="2" >
            <a4j:form id="formLogin" ajaxSubmit="true" >
              <rich:panel>
                <h:panelGrid columns="2">
                    <h:outputText value="User:" />
                    <a4j:outputPanel>
                        <h:inputText id="inputUser" value ="#{Auth.user}"
                                     required="true" requiredMessage="User name required to log into account.">
                            
                        </h:inputText>
                    </a4j:outputPanel>

                    <h:outputText value="Password:" />
                    <a4j:outputPanel>
                        <h:inputSecret id="inputPassword" value ="#{Auth.password}" required="true" requiredMessage="Password required to log into account." />
                    </a4j:outputPanel>

                    <a4j:outputPanel>
                        <!--reRender="panelLogin"-->
                        <a4j:commandButton  value="Login"  action ="#{Auth.login}"/>
                    </a4j:outputPanel>
                </h:panelGrid>
              </rich:panel>
                 <rich:hotKey key="return"  handler="#{rich:element('loginBtn')}.click()"/>
            </a4j:form>
        </h:panelGrid>
      </a4j:outputPanel>
</ui:composition>



Пытаюсь чтобы по нажатию клавиши Enter срабатывала кнопка логина. Но ничего не происходит. Что в данном коде не так? Где я ошибся


Автор: MisterCleric 2.12.2010, 00:47
Привет.
А что такое "loginBtn"? Этот элемент у тебя не определен.
Может id нужно кнопке Login проставить?

Powered by Invision Power Board (http://www.invisionboard.com)
© Invision Power Services (http://www.invisionpower.com)