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

@@ -104,11 +104,27 @@ function addClicked(eleid) {
function writePerson() {
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) {
dwr.util.setValues({id:person.id, label:person.label, min:null, max:null });
dwr.util.setValues({errorMax:"The max value should'nt be superior to the min value"});
dwr.util.setValues({errorMax:"The min value shouldn't be superior to the max value"});
$('errorMax').style.display = "";
}
else {
@@ -160,8 +176,6 @@ var CritereManager = Class.create({
<fmt:param value="4" />
<fmt:param value="5" />
</fmt:message>
<br />
<br />
<p class="formHelp"><fmt:message key="conference.help.step4" /></p>
<form:form commandName="formConference" name="monForm">
@@ -201,12 +215,13 @@ var CritereManager = Class.create({
</tr>
<tr>
<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>
<td>Max:</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>
<td colspan="2" align="right"><span id="id"
@@ -216,10 +231,7 @@ var CritereManager = Class.create({
<td></td>
</tr>
</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>
<td class="formLabel">Criteria list for this conference</td>