Et si votre maison était l’ingrédient secret pour mettre de la magie dans votre vie de famille ? En cette période si particulière, les Grands-Parents auront plus que jamais à cœur de se sentir bien chez eux, seuls ou en tribu. Ce guide a été conçu pour que chacun y trouve des idées pour se sentir serein et en confiance, parfaitement à sa place dans une maison aussi vivante que rassurante.
var input = document.getElementsByTagName('input');
var small = document.getElementById('small');
var currentTab = 0; // Current tab is set to be the first tab (0)
showTab(currentTab); // Display the current tab
function showTab(n) {
// This function will display the specified tab of the form ...
var x = document.getElementsByClassName("tab");
x[n].style.display = "block";
// ... and fix the Previous/Next buttons:
if (n == 0) {
document.getElementById("prevBtn").style.display = "none";
} else {
document.getElementById("prevBtn").style.display = "inline";
}
if (n == (x.length - 1)) {
// document.getElementById("nextBtn").innerHTML = "Recevoir mon guide";
document.getElementById("nextBtn").style.display = "none";
} else {
document.getElementById("nextBtn").innerHTML = "Étape suivante";
}
// background formulaire
if (n == 0) {
document.getElementById("box-formulaire").style.background = "#c5dffa";
}
if (n == 1) {
document.getElementById("box-formulaire").style.background = "#deeaea";
}
if (n == 2) {
document.getElementById("box-formulaire").style.background = "#feecc8";
}
// ... and run a function that displays the correct step indicator:
fixStepIndicator(n)
}
function nextPrev(n) {
// This function will figure out which tab to display
var x = document.getElementsByClassName("tab");
// Exit the function if any field in the current tab is invalid:
if (n == 1 && !validateForm()) return false;
// Hide the current tab:
x[currentTab].style.display = "none";
// Increase or decrease the current tab by 1:
currentTab = currentTab + n;
// if you have reached the end of the form... :
if (currentTab >= x.length) {
//...the form gets submitted:
document.getElementById("regForm").submit();
return false;
}
// Otherwise, display the correct tab:
showTab(currentTab);
}
function validateForm() {
// This function deals with validation of the form fields
var x, y, i, valid = true;
x = document.getElementsByClassName("tab");
y = x[currentTab].getElementsByTagName("input");
s = x[currentTab].getElementsByTagName("small");
// A loop that checks every input field in the current tab:
for (i = 0; i < y.length; i++) {
// If a field is empty...
if (y[i].value == "") {
// add an "invalid" class to the field:
y[i].className += " invalid";
s[i].className += " invalid";
// and set the current valid status to false:
valid = false;
}
}
// If the valid status is true, mark the step as finished and valid:
if (valid) {
document.getElementsByClassName("step")[currentTab].className += " finish";
}
return valid; // return the valid status
}
function fixStepIndicator(n) {
// This function removes the "active" class of all stepsformControl...
var i, x = document.getElementsByClassName("step");
for (i = 0; i < x.length; i++) {
x[i].className = x[i].className.replace(" active", "");
}
//... and adds the "active" class to the current step:
x[n].className += " active";
}
Soyez le plus cool
des Grands-Parents !
La première newsletter qui vous offre
des cadeaux à télécharger gratuitement
pour vos Petits-Enfants.
Vos données seront utilisées par Grand Mercredi pour vous envoyer la newsletter. Vous pouvez à tout moment utiliser le lien de désabonnement dans les newsletters reçues. Pour en savoir plus, consultez notre politique sur les données personnelles.
PS : Pour ne rien louper de nos actualités, pensez à bien vérifier vos spams ! Si jamais nos emails sont dedans, cliquez sur “signaler comme non spam”.