Condition nécessaire de soumission de <FORM> implémentée
This commit is contained in:
parent
b477e9d1dd
commit
4fce4e78a9
|
@ -73,7 +73,7 @@ if(!Authentification::checkUser(0)){
|
|||
<input type='text' id='inDuree' name='duree' placeholder='minutes'><span class='info'>Durée de la consultation</span><br>
|
||||
<br>
|
||||
|
||||
<input type='hidden' name='command' value='consultation:add'>
|
||||
<input type='hidden' name='command' value='Consultation:add'>
|
||||
<input type='submit' value='Enregistrer la consultation'>
|
||||
</form>
|
||||
|
||||
|
|
|
@ -59,7 +59,7 @@ if(!Authentification::checkUser(0)){
|
|||
<input type='radio' name='civilite' value='F' id='civ2'><label for='civ2'>Femme</label><br>
|
||||
<br>
|
||||
|
||||
<input type='hidden' name='command' value='medecin:add'>
|
||||
<input type='hidden' name='command' value='Medecin:add'>
|
||||
<input type='submit' value='Créer le médecin'>
|
||||
</form>
|
||||
|
||||
|
|
|
@ -84,8 +84,8 @@ if(!Authentification::checkUser(0)){
|
|||
?></select>
|
||||
<br>
|
||||
|
||||
<input type='hidden' name='command' value='patient:add'>
|
||||
<input type='submit' value='Créer le patient'>
|
||||
<input type='hidden' name='command' value='Patient:add'>
|
||||
<input type='submit' id='sbCreer' value='Créer le patient'>
|
||||
</form>
|
||||
|
||||
</article>
|
||||
|
|
|
@ -7,6 +7,7 @@ var inVille = document.getElementById('crVille');
|
|||
var inDN = document.getElementById('crDN');
|
||||
var inLN = document.getElementById('crLN');
|
||||
var inSecu = document.getElementById('crSecu');
|
||||
var sbCreer = document.getElementById('sbCreer'); // SUBMIT
|
||||
|
||||
var inCk = new inputChecker();
|
||||
// format de la date
|
||||
|
@ -15,6 +16,7 @@ var dateFormat = new formatChecker(null, 'Ji/Mi/Aiii', { 'J': '[0-3]', 'M': '[0-
|
|||
var secuFormat = new formatChecker(null, 'S ii Mi ii iii iii ii', { 'S': '[0-1]', 'M': '[0-1]' } );
|
||||
inCk.append( inCP, new formatChecker( null, 'iiiii'), '09000'); // on ajoute le CODE_POSTAL au vérificateur de champs
|
||||
inCk.append( inDN, dateFormat, '01/01/2015'); // on ajoute la DATE_NAISSANCE au vérificateur de champs
|
||||
inCk.append( inSecu, secuFormat, '1 99 19 99 999 999 99'); // on ajoute le NUM_SECU au vérificateur de champs
|
||||
|
||||
|
||||
|
||||
|
@ -126,3 +128,14 @@ inSecu.addEventListener('keyup', function(e){
|
|||
}
|
||||
}
|
||||
}, false);
|
||||
|
||||
|
||||
sbCreer.addEventListener('click', function(e){
|
||||
e.preventDefault(); // on annule le submit()
|
||||
|
||||
var inputCheckerValid = inCk.checkAll();
|
||||
var allInputValidated = inPrenom.className.indexOf('validated') > -1 && inNom.className.indexOf('validated') > -1 && inAdr.className.indexOf('validated') > -1 && inAdr2.className.indexOf('validated') > -1 && inCP.className.indexOf('validated') > -1 && inVille.className.indexOf('validated') > -1 && inDN.className.indexOf('validated') > -1 && inLN.className.indexOf('validated') > -1 && inSecu.className.indexOf('validated') > -1;
|
||||
|
||||
if( inputCheckerValid && allInputValidated ) // si tout es ok uniquement, on submit()
|
||||
sbCreer.parentNode.submit();
|
||||
}, false);
|
Loading…
Reference in New Issue