AddConference: ajout de validation

Login: tentative de repérage de la touche entrée
This commit is contained in:
Frederic Debuire
2008-02-15 21:39:22 +00:00
parent 363238ce30
commit 1618337b39
7 changed files with 82 additions and 31 deletions

View File

@@ -12,6 +12,22 @@
<title><fmt:message key="title" /></title> <title><fmt:message key="title" /></title>
<link rel="stylesheet" href="./stylesheets/base.css" type="text/css" /> <link rel="stylesheet" href="./stylesheets/base.css" type="text/css" />
<script type='text/javascript' src='./javascripts/rounded_boxes.js'></script> <script type='text/javascript' src='./javascripts/rounded_boxes.js'></script>
<script type="text/javascript">
var LoginManager = Class.create({
initialize: function(inputField, inputField2){
$(inputField).observe("keypress", this.KeyPressHandler.bindAsEventListener(this));
$(inputField2).observe("keypress", this.KeyPressHandler.bindAsEventListener(this));
},
KeyPressHandler: function(event){
switch(event.keyCode){
case Event.KEY_RETURN:
$('mainformlogin').submit();
}
}
});
</script>
<decorator:head /> <decorator:head />
</head> </head>

View File

@@ -30,25 +30,25 @@
<td class="formLabel"><fmt:message key="conference2.article" /> <td class="formLabel"><fmt:message key="conference2.article" />
</td> </td>
<td><form:input onclick="ds_sh(this);" path="dateArticle" <td><form:input onclick="ds_sh(this);" path="dateArticle"
cssStyle="cursor: text" /> <form:errors path="dateArticle" /></td> cssStyle="cursor: text" /> <div class="formError"><form:errors path="dateArticle" /></div></td>
</tr> </tr>
<tr> <tr>
<td class="formLabel"><fmt:message key="conference2.evaluation" /> <td class="formLabel"><fmt:message key="conference2.evaluation" />
</td> </td>
<td><form:input onclick="ds_sh(this);" path="dateEvaluation" <td><form:input onclick="ds_sh(this);" path="dateEvaluation"
cssStyle="cursor: text" /> <form:errors path="dateEvaluation" /> cssStyle="cursor: text" /> <div class="formError"><form:errors path="dateEvaluation" /></div>
</td> </td>
</tr> </tr>
<tr> <tr>
<td class="formLabel"><fmt:message key="conference2.start" /> <td class="formLabel"><fmt:message key="conference2.start" />
</td> </td>
<td><form:input onclick="ds_sh(this);" path="dateStart" <td><form:input onclick="ds_sh(this);" path="dateStart"
cssStyle="cursor: text" /> <form:errors path="dateStart" /></td> cssStyle="cursor: text" /> <div class="formError"><form:errors path="dateStart" /></div></td>
</tr> </tr>
<tr> <tr>
<td class="formLabel"><fmt:message key="conference2.end" /></td> <td class="formLabel"><fmt:message key="conference2.end" /></td>
<td><form:input onclick="ds_sh(this);" path="dateEnd" <td><form:input onclick="ds_sh(this);" path="dateEnd"
cssStyle="cursor: text" /> <form:errors path="dateEnd" /></td> cssStyle="cursor: text" /> <div class="formError"><form:errors path="dateEnd" /></div></td>
</tr> </tr>
</tbody> </tbody>
<tfoot> <tfoot>

View File

@@ -1,7 +1,25 @@
<%@ include file="/WEB-INF/decorators/include.jsp"%> <%@ include file="/WEB-INF/decorators/include.jsp"%>
<html> <html>
<head></head> <head>
<script type='text/javascript' src='./javascripts/prototype.js'></script>
<script type='text/javascript'>
function verifNumber() {
var re = /^\d+$/;
if(!re.test($('pageNumber').value))
$('errorNumber').style.display = "";
else
$('errorNumber').style.display = "none";
}
</script>
</head>
<body> <body>
@@ -21,8 +39,6 @@
<p class="formHelp"><fmt:message key="conference.help.step3" /></p> <p class="formHelp"><fmt:message key="conference.help.step3" /></p>
<form:form commandName="formConference" name="monForm"> <form:form commandName="formConference" name="monForm">
<div class="formErrors"><form:errors path="*" /></div>
<table> <table>
<thead> <thead>
<tr> <tr>
@@ -32,7 +48,7 @@
<tbody> <tbody>
<tr> <tr>
<td class="formLabel">Page's numbers</td> <td class="formLabel">Page's numbers</td>
<td><form:input path="pageNumber" /></td> <td><form:input id="pageNumber" path="pageNumber" onchange="verifNumber();"/><div class="formError"><span id="errorNumber" style="display: none;">It should be a number</span></div></td>
</tr> </tr>
<tr> <tr>
<td class="formLabel">Authorized file types</td> <td class="formLabel">Authorized file types</td>
@@ -62,6 +78,10 @@
</table> </table>
</form:form> </form:form>
<script type="text/javascript">
verifNumber();
</script>
<a href="<c:url value="main.htm"/>">Home</a> <a href="<c:url value="main.htm"/>">Home</a>
</body> </body>

View File

@@ -106,9 +106,25 @@ function writePerson() {
var person = { id:viewed, label:null, min:null, max:null }; var person = { id:viewed, label:null, min:null, max:null };
dwr.util.getValues(person); dwr.util.getValues(person);
var re = /^\d+$/;
if(!re.test(person.min)) {
dwr.util.setValues({errorMin:"It should be a number"});
$('errorMin').style.display = "";
return false;
}
else
$('errorMin').style.display = "none";
if(!re.test(person.max)) {
dwr.util.setValues({errorMax:"It should be a number"});
$('errorMax').style.display = "";
return false;
}
else
$('errorMax').style.display = "none";
if (person.max <= person.min) { if (person.max <= person.min) {
dwr.util.setValues({id:person.id, label:person.label, min:null, max:null }); dwr.util.setValues({errorMax:"The min value shouldn't be superior to the max value"});
dwr.util.setValues({errorMax:"The max value should'nt be superior to the min value"});
$('errorMax').style.display = ""; $('errorMax').style.display = "";
} }
else { else {
@@ -160,8 +176,6 @@ var CritereManager = Class.create({
<fmt:param value="4" /> <fmt:param value="4" />
<fmt:param value="5" /> <fmt:param value="5" />
</fmt:message> </fmt:message>
<br />
<br />
<p class="formHelp"><fmt:message key="conference.help.step4" /></p> <p class="formHelp"><fmt:message key="conference.help.step4" /></p>
<form:form commandName="formConference" name="monForm"> <form:form commandName="formConference" name="monForm">
@@ -202,11 +216,12 @@ var CritereManager = Class.create({
<tr> <tr>
<td>Min:</td> <td>Min:</td>
<td><input id="min" type="text" /></td> <td><input id="min" type="text" /></td>
<td><div class="formError"><span id="errorMin" style="display: none;"></span></div></td>
</tr> </tr>
<tr> <tr>
<td>Max:</td> <td>Max:</td>
<td><input id="max" type="text" /></td> <td><input id="max" type="text" /></td>
<td><span id="errorMax"></span></td> <td><div class="formError"><span id="errorMax" style="display: none;"></span></div></td>
</tr> </tr>
<tr> <tr>
<td colspan="2" align="right"><span id="id" <td colspan="2" align="right"><span id="id"
@@ -216,10 +231,7 @@ var CritereManager = Class.create({
<td></td> <td></td>
</tr> </tr>
</table> </table>
<script type="text/javascript"> new CritereManager('label', 'min', 'max');</script></td>
<script type="text/javascript">
new CritereManager('label', 'min', 'max');
</script></td>
</tr> </tr>
<tr> <tr>
<td class="formLabel">Criteria list for this conference</td> <td class="formLabel">Criteria list for this conference</td>

View File

@@ -132,7 +132,7 @@ function filterUser(el, value) {
<tr> <tr>
<td class="formLabel"><fmt:message key="conference5.findUsers" /> <td class="formLabel"><fmt:message key="conference5.findUsers" />
</td> </td>
<td>Filter <form:input id="myfilter" path="myfilter" /> <br /> <td><form:input id="myfilter" path="myfilter" /> <br />
<br /> <br />
<table border="1" id="tableName" style="display: none;"> <table border="1" id="tableName" style="display: none;">
<thead> <thead>
@@ -154,7 +154,7 @@ function filterUser(el, value) {
<tr> <tr>
<td class="formLabel"><fmt:message key="conference5.usersList" /> <td class="formLabel"><fmt:message key="conference5.usersList" />
</td> </td>
<td> <td><br />
<table border="1" id="tableNameAdded" style="display: none;"> <table border="1" id="tableNameAdded" style="display: none;">
<thead> <thead>
<tr> <tr>
@@ -175,7 +175,7 @@ function filterUser(el, value) {
<tr> <tr>
<td class="formLabel"><fmt:message <td class="formLabel"><fmt:message
key="conference5.invitation.send" /></td> key="conference5.invitation.send" /></td>
<td>eMail: <input id="emailAddress" type="text" /> <input <td><input id="emailAddress" type="text" /> <input
type="button" name="inviteButton" id="inviteButton" value="Invite" /> type="button" name="inviteButton" id="inviteButton" value="Invite" />
</td> </td>
</tr> </tr>

View File

@@ -23,13 +23,14 @@
</td><td> </td><td>
<div class="cbb"> <div class="cbb">
<h2><fmt:message key="login.label.alreadyaccount" /> :</h2> <h2><fmt:message key="login.label.alreadyaccount" /> :</h2>
<form action="<c:url value='j_acegi_security_check'/>" method="POST" id="formlogin"> <form action="<c:url value='j_acegi_security_check'/>" method="POST" id="mainformlogin">
<fmt:message key="login.label.login" /> : <input type='text' name='j_username' /><br /> <fmt:message key="login.label.login" /> : <input id="username" type='text' name='j_username' /><br />
<fmt:message key="login.label.password" /> : <input type='password' name='j_password' /><br /> <fmt:message key="login.label.password" /> : <input id="password" type='password' name='j_password' /><br />
<input type="checkbox" name="_acegi_security_remember_me"/>&nbsp;&nbsp;<fmt:message key='login.label.rememberme' /><br /> <input type="checkbox" name="_acegi_security_remember_me"/>&nbsp;&nbsp;<fmt:message key='login.label.rememberme' /><br />
<br /><br /> <br /><br />
<a href="javascript:document.getElementById('formlogin').submit();" id="submit_btn"><fmt:message key="login.btn.connexion" /></a> <a href="javascript:document.getElementById('mainformlogin').submit();" id="submit_btn"><fmt:message key="login.btn.connexion" /></a>
<script type="text/javascript"> new LoginManager('username', 'password');</script>
</form> </form>
<div class="yacos_button"> <div class="yacos_button">
<a href="<c:url value="/forgotPassword.htm"/>"> <a href="<c:url value="/forgotPassword.htm"/>">
@@ -39,5 +40,6 @@
</div> </div>
</td></tr> </td></tr>
</table> </table>
</body> </body>
</html> </html>

View File

@@ -1,18 +1,19 @@
<%@ include file="/WEB-INF/decorators/include.jsp"%> <%@ include file="/WEB-INF/decorators/include.jsp"%>
<html> <html>
<head></head> <head>
</head>
<body> <body>
<form action="<c:url value='j_acegi_security_check'/>" method="POST" id="mainformlogin"> <form action="<c:url value='j_acegi_security_check'/>" method="POST" id="mainformlogin">
<fmt:message key="login.txt.login"/> : <fmt:message key="login.txt.login"/> :
<input type='text' name='j_username' value="<fmt:message key='login.field.login' />" onfocus="if (this.value == '<fmt:message key='login.field.login' />') { this.value = ''; }" onblur="if (this.value == '') { this.value = '<fmt:message key='login.field.login' />'; }" /> <input id="username" type='text' name='j_username' value="<fmt:message key='login.field.login' />" onfocus="if (this.value == '<fmt:message key='login.field.login' />') { this.value = ''; }" onblur="if (this.value == '') { this.value = '<fmt:message key='login.field.login' />'; }" />
<input type='password' name='j_password' /> <input id="password" type='password' name='j_password' />
<a href="javascript:document.getElementById('mainformlogin').submit();" id="submit_btn"><fmt:message key="login.btn.connexion" /></a> <a href="javascript:document.getElementById('mainformlogin').submit();" id="submit_btn"><fmt:message key="login.btn.connexion" /></a>
<br /> <br />
<a href="login.htm" id="connexion"><fmt:message key="login.label.register"/></a> <a href="login.htm" id="connexion"><fmt:message key="login.label.register"/></a>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<fmt:message key='login.label.rememberme' />&nbsp;&nbsp;<input type="checkbox" name="_acegi_security_remember_me"/> <fmt:message key='login.label.rememberme' />&nbsp;&nbsp;<input type="checkbox" name="_acegi_security_remember_me"/>
<script type="text/javascript"> new LoginManager('username', 'password');</script>
</form> </form>
</body> </body>
</html> </html>