changeset 28:b943b16d9b33

Fixed: Issue with login password entry Previously: After typing in password to login, pressing enter would refresh the page. Fixed: Added script to login.xhtml to register the enter key being pressed after password entry as an equivalent to clicking the "Login" button. Alistair.
author arussell
date Thu, 14 May 2015 20:37:24 +0000
parents 0f907d47b956
children 620b58e5c69b
files src/main/webapp/entry/components/login.xhtml
diffstat 1 files changed, 23 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/src/main/webapp/entry/components/login.xhtml	Wed May 13 15:26:23 2015 +0000
+++ b/src/main/webapp/entry/components/login.xhtml	Thu May 14 20:37:24 2015 +0000
@@ -1,10 +1,10 @@
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 <html xmlns="http://www.w3.org/1999/xhtml"
-	xmlns:h="http://java.sun.com/jsf/html"
-	xmlns:f="http://java.sun.com/jsf/core"
-	xmlns:ui="http://java.sun.com/jsf/facelets"
-	xmlns:a4j="http://richfaces.org/a4j"
-	xmlns:rich="http://richfaces.org/rich">
+	  xmlns:h="http://java.sun.com/jsf/html"
+	  xmlns:f="http://java.sun.com/jsf/core"
+	  xmlns:ui="http://java.sun.com/jsf/facelets"
+	  xmlns:a4j="http://richfaces.org/a4j"
+	  xmlns:rich="http://richfaces.org/rich" xmlns:p="http://java.sun.com/jsf/html">
 <body>
 	<ui:composition>
 
@@ -22,16 +22,30 @@
 
 			<h:panelGrid columns="1" styleClass="ismi-pp-main-panel">
 					<h:panelGrid columns="2" style="text-align:left;">
+						<!-- Currently enter procs login but esc does not proc cancel -->
+						<script>
+							function handlerKeyPress(event) {
+								if (event.keyCode == 13) {
+									$('.login').click();
+									return false;
+								} else if (event.keyCode == 27) {
+									$('.cancel').click();
+									return false;
+								} else {
+									return true;
+								}
+							}
+						</script>
 						<h:outputText value="Email" />
-						<h:inputText value="#{Session.username}" size="40" />
+						<h:inputText value="#{Session.username}" size="40" onkeypress="return handlerKeyPress(event);" />
 						<h:outputText value="Password" />
-						<h:inputSecret value="#{Session.password}" size="40" />
+						<h:inputSecret value="#{Session.password}" size="40" onkeypress="return handlerKeyPress(event);" />
 					</h:panelGrid>
 
 					<h:panelGrid columns="2">
-						<h:commandButton value="Cancel"
+						<h:commandButton value="Cancel" styleClass="cancel btn btn-default"
 							action="#{Session.actionLoginCancel}" />
-						<h:commandButton value="Login"
+						<h:commandButton value="Login" styleClass="login btn btn-default"
 							actionListener="#{Session.listenerLogin}" />
 					</h:panelGrid>
 			</h:panelGrid>