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 47 48 49 50 51 52 53 54
| function AjoutFormation(){
getNiveau = document.getElementById('form_niveau');
getCateg = document.getElementById('form_categ_formation');
getFiliere = document.getElementById('form_filiere');
getIntitule = document.getElementById('formation_intitule');
getDesc = document.getElementById('formation_description');
getDuree = document.getElementById('formation_duree');
getfrais = document.getElementById('formation_frais');
getAdmission = document.getElementById('formation_admission');
getInitial = document.getElementById('parcours_1');
getAltern = document.getElementById('parcours_2');
getDist = document.getElementById('parcours_3');
niveau = ''; if(getNiveau.value != 0) niveau = getNiveau.options[getNiveau.selectedIndex].text;
formation = ''; if(getCateg.value != 0) formation =getCateg.options[getCateg.selectedIndex].text;
filiere = ''; if( getFiliere != null && getFiliere.value != 0){
filiere = getFiliere.options[getFiliere.selectedIndex].text;
}
initial = getInitial.checked; if(initial == false){initial = '';}else{initial = ' - Initial'; }
alternance = getAltern.checked; if(alternance == false){alternance = '';}else{alternance = ' - Alternance'; }
distance = getDist.checked; if(distance == false){distance = '';}else{distance = ' - Distance'; }
intitule = getIntitule.value; ;
description = getDesc.value;;
duree = getDuree.value; ;
frais = getfrais.value; ;
admission = getAdmission.value; ;
if(niveau != '' && filiere != '' && formation != '' && (initial != false || alternance != false || distance != false) && intitule != '' && description != ''){
var innerDiv = document.createElement('div');
innerDiv.className = 'formation-block';
innerDiv.id = Math.floor(Math.random() * (999 - 1 + 1)) + 1;
innerDiv.innerHTML = '<p class="title-formation" value="">■ '+niveau+'</p><p class="filiere">→ '+formation+' - '+filiere+initial+alternance+distance+'</p><p id="'+innerDiv.id+'-7" class="intitule-formation">'+intitule+'</p><p id="'+innerDiv.id+'-8" class="description-formation">'+description+'<p><ul><li><strong>Durée</strong>: <span id="'+innerDiv.id+'-9">'+duree+'</span></li><li><strong>Frais</strong>: <span id="'+innerDiv.id+'-10">'+frais+'</span></li><li><strong>Admission</strong>: <span id="'+innerDiv.id+'-11">'+admission+'</span></li></ul><a id="delet-formation" class="button" onclick="document.getElementById('+innerDiv.id+').remove()">Supprimer</a> <a id="modif-formation" class="button" onclick="ModifFormation('+innerDiv.id+')">Modifier</a><div class="displaynone"><input id="'+innerDiv.id+'-1" type="hidden" value="'+getNiveau.selectedIndex+'"/><input id="'+innerDiv.id+'-2" type="hidden" value="'+getCateg.selectedIndex+'"/><input id="'+innerDiv.id+'-3" type="hidden" value="'+getFiliere.selectedIndex+'"/><input id="'+innerDiv.id+'-4" type="hidden" value="'+getInitial.checked+'"/><input id="'+innerDiv.id+'-5" type="hidden" value="'+getAltern.checked+'"/><input id="'+innerDiv.id+'-6" type="hidden" value="'+getDist.checked+'"/></div>';
document.getElementById('ajout-formation').appendChild(innerDiv);
getNiveau.selectedIndex = 0;
getCateg.selectedIndex = 0;
getFiliere.selectedIndex = 0;
getInitial.checked= false;
getAltern.checked= false;
getDist.checked= false;
getIntitule.value = ''
getDesc.value = ''
getDuree.value = ''
getfrais.value = ''
getAdmission.value = ''
}
else{
alert('Veuillez remplir tout les champs obligatoires.');
}
} |
Partager