Interdire les saisies "rétro-actives"
Bonjour,
Dans le cadre d'une application web de gestion de projet, j'ai un formulaire de demandes de ressources (= jour/homme) pour chaque projet.
J'aimerai interdire dans ce formulaire la saisie de demande pour les mois déjà écoulés.
Voici à quoi ressemble le formulaire :
http://www.hostingpics.net/viewer.ph...34formdmde.jpg
et voici le code correspondant
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
| function verif_dispo(nom_select) {
valeur = document.getElementById(nom_select).value;
if (valeur === "") {
alert("Pas d'équipe sélectionnée.");
} else {
var page = "surcharge.php?id=" + valeur;
window.open(page, valeur, "menubar = no, status = no, scrollbars = no, menubar = no, width = 800, height = 600");
}
}
function create_champ(i) {
var i = parseInt($("#add_equ").attr("increment"));
var contenu_tab = $('#tab_demande').html();
var i2 = i + 1;
$("#add_equ").attr("increment", i2);
var equipe = 'equipe_' + i;
var champs = '<input type="hidden" name="indice" value="' + i + '"/>' + i + '<tr><td><select name="role_' + i + '"><option> </option><option>C</option><option>P</option></select></td>' +
'<td><select name="' + equipe + '" id="' + equipe + '">' + $('.liste_equ').html() + '</select></td>' +
'<td><select name="annee_' + i + '">' + $('.liste_annee').html() + '</select></td>' +
'<td><input type="text" style="width:25px" name="1_' + i + '"></td>' +
'<td><input type="text" style="width:25px" name="2_' + i + '"></td>' +
'<td><input type="text" style="width:25px" name="3_' + i + '"></td>' +
'<td><input type="text" style="width:25px" name="4_' + i + '"></td>' +
'<td><input type="text" style="width:25px" name="5_' + i + '"></td>' +
'<td><input type="text" style="width:25px" name="6_' + i + '"></td>' +
'<td><input type="text" style="width:25px" name="7_' + i + '"></td>' +
'<td><input type="text" style="width:25px" name="8_' + i + '"></td>' +
'<td><input type="text" style="width:25px" name="9_' + i + '"></td>' +
'<td><input type="text" style="width:25px" name="10_' + i + '"></td>' +
'<td><input type="text" style="width:25px" name="11_' + i + '"></td>' +
'<td><input type="text" style="width:25px" name="12_' + i + '"></td>' +
'<td><input type="button" onClick="verif_dispo(\'' + equipe + '\')" name="Submit" value="Disponibilité"></td>' +
'</tr>';
contenu_tab = contenu_tab + champs;
$('#tab_demande').html(contenu_tab);
} |
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
| <label for="nom">Nom du demandeur :</label><input type="text" id="nom" name="nom" style="width:300px" value="<?php echo $_SESSION['login']; ?>"><br />
<br/>
<div id="test" style="min-height: 115px;padding-bottom: 15px;">
<table id="tab_demande" style="margin-bottom:10px;">
<tr>
<th>Rôle</th>
<th>Equipe</th>
<th>Année</th>
<th>Jan</th>
<th>Fév</th>
<th>Mar</th>
<th>Avr</th>
<th>Mai</th>
<th>Juin</th>
<th>Juil</th>
<th>Août</th>
<th>Sept</th>
<th>Oct</th>
<th>Nov</th>
<th>Déc</th>
<th></th>
</tr>
<tr>
<input type="hidden" name="indice" value="0"/>
<td><select name="role_0"><option> </option><option>C</option><option>P</option></select></td>
<td><?php echo select_equip('equipe_0'); ?></td>
<td><?php echo select_annee('annee_0'); ?></td>
<td><input type="text" style="width:25px" name="1_0"></td>
<td><input type="text" style="width:25px" name="2_0"></td>
<td><input type="text" style="width:25px" name="3_0"></td>
<td><input type="text" style="width:25px" name="4_0"></td>
<td><input type="text" style="width:25px" name="5_0"></td>
<td><input type="text" style="width:25px" name="6_0"></td>
<td><input type="text" style="width:25px" name="7_0"></td>
<td><input type="text" style="width:25px" name="8_0"></td>
<td><input type="text" style="width:25px" name="9_0"></td>
<td><input type="text" style="width:25px" name="10_0"></td>
<td><input type="text" style="width:25px" name="11_0"></td>
<td><input type="text" style="width:25px" name="12_0"></td>
<td><input type="button" onClick="verif_dispo('equipe_0')" name="Submit" value="Disponibilité"></td>
</tr>
</table>
<a id="add_equ" href="javascript:create_champ(1)" increment="1">Ajouter une équipe</a>
</div>
<script> document.write(i2); </script> |
J'avais déjà fait une demande un peu similaire, pour la surcharge d'une équipe, mais j'ai abandonné l'idée au profit d'un bouton "disponibilité" (cf : http://www.developpez.net/forums/d13...te-deroulante/ )
En vous remerciant d'avance,
Bonne journée !