// JavaScript Document : fonction de validation des formulaires function isValidEmail(str) { //return (str.indexOf(".") > 2) && (str.indexOf("@") > 0); return (str.indexOf("@") > 0); } //INSCRIPTION_DEMANDEUR.PHP function valid_form_deposer_annonce(){ //DEPARTMENT if (document.getElementById('departement').value==""){ alert('Veuillez saisir votre departement'); document.getElementById('departement').focus(); document.getElementById('departement').style.backgroundColor = "red"; return false; }else{ document.getElementById('departement').style.backgroundColor = "white"; } //VILLE if (document.getElementById('ville1').value==""){ alert('Veuillez saisir au moins une ville'); document.getElementById('ville1').focus(); document.getElementById('ville1').style.backgroundColor = "red"; return false; }else{ document.getElementById('ville1').style.backgroundColor = "white"; } //CATEGORIE : DEMANDE D'ACHAT OU LOCATION if ( (document.getElementById('categoriebien_achat').checked==false) && (document.getElementById('categoriebien_location').checked==false) ) { alert('Souhaitez vous acheter ou louer ?'); document.getElementById('categoriebien_achat').focus(); document.getElementById('categoriebien_achat').style.backgroundColor = "red"; return false; }else{ document.getElementById('categoriebien_achat').style.backgroundColor = "white"; } //TYPE DE BIEN if (document.getElementById('typebien').value==""){ alert('Veuillez saisir le type de bien'); document.getElementById('typebien').focus(); document.getElementById('typebien').style.backgroundColor = "red"; return false; }else{ document.getElementById('typebien').style.backgroundColor = "white"; } //SELON TYPE DE BIEN : TOUS SAUF 6. GARAGE ET 7. PLACE DE PARKING // 1. APPARTEMENT // 15. BUREAU // 13. FOND DE COMMERCE // 6. GARAGE // 12. LOCAUX COMMERCIAUX // 9. LOFT // 3. MAISON OU VILLA // 7. PLACE DE PARKING // 4. TERRAIN // 10. VIAGER APPARTEMENT // 11. VIAGER MAISON //alert('typebien=' + document.getElementById('typebien').value); if ( (document.getElementById('typebien').value!='6') && (document.getElementById('typebien').value!='7') ){ // SURFACE MIN //alert('surfacemin=' + document.getElementById('surfacemin').value); if ( (document.getElementById('surfacemin').value=="") || (document.getElementById('surfacemin').value=="0") ){ alert('Veuillez saisir la surface minimum'); document.getElementById('surfacemin').focus(); document.getElementById('surfacemin').style.backgroundColor = "red"; return false; }else{ document.getElementById('surfacemin').style.backgroundColor = "white"; } //BUDGET MAX //alert('budgetmax=' + document.getElementById('budgetmax').value); if ( (document.getElementById('budgetmax').value=="") || (document.getElementById('budgetmax').value=="0") ){ alert('Veuillez saisir le budget maximum'); document.getElementById('budgetmax').focus(); document.getElementById('budgetmax').style.backgroundColor = "red"; return false; }else{ document.getElementById('budgetmax').style.backgroundColor = "white"; } } //NB PIECES OBLIGATOIRE POUR 1. APPARTEMENT ET 3. MAISON if ( (document.getElementById('typebien').value=='1') || (document.getElementById('typebien').value=='3') ){ if (document.getElementById('nbpieces').value==""){ alert('Veuillez saisir le nombre de pièces'); //document.getElementById('nbpieces').focus();//Pas compatible avec IE document.getElementById('nbpieces').style.backgroundColor = "red"; return false; }else{ document.getElementById('nbpieces').style.backgroundColor = "white"; } } return true; } //INSCRIPTION_DEMANDEUR.PHP function valid_form_demandeur(){ if (document.getElementById('nom').value==""){ alert('Veuillez saisir votre nom'); document.getElementById('nom').focus(); document.getElementById('nom').style.backgroundColor = "red"; return false; }else{ document.getElementById('nom').style.backgroundColor = "white"; } if (document.getElementById('prenom').value==""){ alert('Veuillez saisir votre prénom'); document.getElementById('prenom').focus(); document.getElementById('prenom').style.backgroundColor = "red"; return false; }else{ document.getElementById('prenom').style.backgroundColor = "white"; } /* if (document.getElementById('adresse').value==""){ alert('Veuillez saisir votre adresse'); document.getElementById('adresse').focus(); document.getElementById('adresse').style.backgroundColor = "red"; return false; }else{ document.getElementById('adresse').style.backgroundColor = "white"; } if (document.getElementById('cp').value==""){ alert('Veuillez saisir votre code postal'); document.getElementById('cp').focus(); document.getElementById('cp').style.backgroundColor = "red"; return false; }else{ document.getElementById('cp').style.backgroundColor = "white"; } if (document.getElementById('ville').value==""){ alert('Veuillez saisir votre ville'); document.getElementById('ville').focus(); document.getElementById('ville').style.backgroundColor = "red"; return false; }else{ document.getElementById('adresse').style.backgroundColor = "white"; } */ if (document.getElementById('emaildemandeur').value==""){ alert('Veuillez saisir votre email'); document.getElementById('emaildemandeur').focus(); document.getElementById('emaildemandeur').style.backgroundColor = "red"; return false; }else{ document.getElementById('emaildemandeur').style.backgroundColor = "white"; } if (isValidEmail(document.getElementById('emaildemandeur').value)==false){ alert('L\'email n\'est pas au format attendu (exemple : votrenom@exemple.com)'); document.getElementById('emaildemandeur').focus(); document.getElementById('emaildemandeur').style.backgroundColor = "red"; return false; }else{ document.getElementById('emaildemandeur').style.backgroundColor = "white"; } if (document.getElementById('motdepassedemandeur').value==""){ alert('Veuillez saisir votre mot de passe'); document.getElementById('motdepassedemandeur').focus(); document.getElementById('motdepassedemandeur').style.backgroundColor = "red"; return false; }else{ document.getElementById('motdepassedemandeur').style.backgroundColor = "white"; } return true; } //INDEX.PHP ET RECHERCHE_PRO.PHP function valid_form_departement(){ if (document.getElementById('departement').value==""){ alert('Veuillez saisir un département'); document.getElementById('departement').focus(); document.getElementById('departement').style.backgroundColor = "red"; return false; }else{ document.getElementById('departement').style.backgroundColor = "white"; } } //INDEX.PHP function valid_form_numero(){ if (document.getElementById('numero').value==""){ alert('Veuillez saisir un numéro'); document.getElementById('numero').focus(); document.getElementById('numero').style.backgroundColor = "red"; return false; }else{ document.getElementById('numero').style.backgroundColor = "white"; } } //FORMULAIRE DE LOGIN function valid_form_login(){ if (document.getElementById('email_login').value==""){ alert('Veuillez saisir votre email'); document.getElementById('email_login').focus(); document.getElementById('email_login').style.backgroundColor = "red"; return false; }else{ document.getElementById('email_login').style.backgroundColor = "white"; } if (isValidEmail(document.getElementById('email_login').value)==false){ alert('L\'email n\'est pas au format attendu (exemple : votrenom@exemple.com)'); document.getElementById('email_login').focus(); document.getElementById('email_login').style.backgroundColor = "red"; return false; }else{ document.getElementById('email_login').style.backgroundColor = "white"; } if (document.getElementById('motdepasse_login').value==""){ alert('Veuillez saisir votre mot de passe'); document.getElementById('motdepasse_login').focus(); document.getElementById('motdepasse_login').style.backgroundColor = "red"; return false; }else{ document.getElementById('motdepasse_login').style.backgroundColor = "white"; } return true; } //INSCRIPTION.PHP function valid_form_inscription_agence_vendeur(){ // PROFIL : VENDEUR PRO ou PARTICULIER if (document.getElementById('profil').value==""){ alert('Veuillez saisir votre profil'); document.getElementById('profil').focus(); document.getElementById('profil').style.backgroundColor = "red"; return false; }else{ document.getElementById('profil').style.backgroundColor = "white"; } // ENTREPRISE if (document.getElementById('entreprise').value==""){ alert('Veuillez saisir votre entreprise'); document.getElementById('entreprise').focus(); document.getElementById('entreprise').style.backgroundColor = "red"; return false; }else{ document.getElementById('entreprise').style.backgroundColor = "white"; } // ADRESSE if (document.getElementById('adresse').value==""){ alert('Veuillez saisir votre adresse'); document.getElementById('adresse').focus(); document.getElementById('adresse').style.backgroundColor = "red"; return false; }else{ document.getElementById('adresse').style.backgroundColor = "white"; } //CODE POSTAL if (document.getElementById('cp').value==""){ alert('Veuillez saisir votre code postal'); document.getElementById('cp').focus(); document.getElementById('cp').style.backgroundColor = "red"; return false; }else{ document.getElementById('cp').style.backgroundColor = "white"; } // VILLE if (document.getElementById('ville').value==""){ alert('Veuillez saisir votre ville'); document.getElementById('ville').focus(); document.getElementById('ville').style.backgroundColor = "red"; return false; }else{ document.getElementById('ville').style.backgroundColor = "white"; } // NOM if (document.getElementById('nom').value==""){ alert('Veuillez saisir votre nom'); document.getElementById('nom').focus(); document.getElementById('nom').style.backgroundColor = "red"; return false; }else{ document.getElementById('nom').style.backgroundColor = "white"; } // PRENOM if (document.getElementById('prenom').value==""){ alert('Veuillez saisir votre prénom'); document.getElementById('prenom').focus(); document.getElementById('prenom').style.backgroundColor = "red"; return false; }else{ document.getElementById('prenom').style.backgroundColor = "white"; } // EMAIL if (document.getElementById('email').value==""){ alert('Veuillez saisir votre email'); document.getElementById('email').focus(); document.getElementById('email').style.backgroundColor = "red"; return false; }else{ document.getElementById('email').style.backgroundColor = "white"; } if (isValidEmail(document.getElementById('email').value)==false){ alert('L\'email n\'est pas au format attendu (exemple : votrenom@exemple.com)'); document.getElementById('email').focus(); document.getElementById('email').style.backgroundColor = "red"; return false; }else{ document.getElementById('email').style.backgroundColor = "white"; } // MOT DE PASSE if (document.getElementById('motdepasse').value==""){ alert('Veuillez saisir votre mot de passe'); document.getElementById('motdepasse').focus(); document.getElementById('motdepasse').style.backgroundColor = "red"; return false; }else{ document.getElementById('motdepasse').style.backgroundColor = "white"; } // DEPARTEMENT if (document.getElementById('departement').value==""){ alert('Veuillez saisir votre departement'); document.getElementById('departement').focus(); document.getElementById('departement').style.backgroundColor = "red"; return false; }else{ document.getElementById('departement').style.backgroundColor = "white"; } // VILLE if (document.getElementById('ville1').value==""){ alert('Veuillez saisir au moins une ville'); document.getElementById('ville1').focus(); document.getElementById('ville1').style.backgroundColor = "red"; return false; }else{ document.getElementById('ville1').style.backgroundColor = "white"; } // GENRE DE DEMANDE A RECEVOIR : ACHAT ou LOCATION //alert('recevoir_demande_location=' + document.getElementById('recevoir_demande_location').checked); //alert('recevoir_demande_achat=' + document.getElementById('recevoir_demande_achat').checked); if ( (document.getElementById('recevoir_demande_location').checked==false) && (document.getElementById('recevoir_demande_achat').checked==false) ){ alert('Veuillez indiquez le genre de demande qui vous interresse'); document.getElementById('recevoir_demande_achat').focus(); document.getElementById('recevoir_demande_achat').style.backgroundColor = "red"; return false; }else{ document.getElementById('recevoir_demande_achat').style.backgroundColor = "white"; } return true; } function valid_form_inscription_particulier_vendeur(){ // PROFIL : VENDEUR PRO ou PARTICULIER if (document.getElementById('profil').value==""){ alert('Veuillez saisir votre profil'); document.getElementById('profil').focus(); document.getElementById('profil').style.backgroundColor = "red"; return false; }else{ document.getElementById('profil').style.backgroundColor = "white"; } // NOM if (document.getElementById('pnom').value==""){ alert('Veuillez saisir votre nom'); document.getElementById('pnom').focus(); document.getElementById('pnom').style.backgroundColor = "red"; return false; }else{ document.getElementById('pnom').style.backgroundColor = "white"; } // PRENOM if (document.getElementById('pprenom').value==""){ alert('Veuillez saisir votre prénom'); document.getElementById('pprenom').focus(); document.getElementById('pprenom').style.backgroundColor = "red"; return false; }else{ document.getElementById('pprenom').style.backgroundColor = "white"; } //EMAIL if (document.getElementById('pemail').value==""){ alert('Veuillez saisir votre email'); document.getElementById('pemail').focus(); document.getElementById('pemail').style.backgroundColor = "red"; return false; }else{ document.getElementById('pemail').style.backgroundColor = "white"; } if (isValidEmail(document.getElementById('pemail').value)==false){ alert('L\'email n\'est pas au format attendu (exemple : votrenom@exemple.com)'); document.getElementById('pemail').focus(); document.getElementById('pemail').style.backgroundColor = "red"; return false; }else{ document.getElementById('pemail').style.backgroundColor = "white"; } // MOT DE PASSE if (document.getElementById('pmotdepasse').value==""){ alert('Veuillez saisir votre mot de passe'); document.getElementById('pmotdepasse').focus(); document.getElementById('pmotdepasse').style.backgroundColor = "red"; return false; }else{ document.getElementById('pmotdepasse').style.backgroundColor = "white"; } // DEPARTEMENT if (document.getElementById('pdepartement').value==""){ alert('Veuillez saisir votre departement'); document.getElementById('pdepartement').focus(); document.getElementById('pdepartement').style.backgroundColor = "red"; return false; }else{ document.getElementById('pdepartement').style.backgroundColor = "white"; } // VILLE if (document.getElementById('pville1').value==""){ alert('Veuillez saisir au moins une ville'); document.getElementById('pville1').focus(); document.getElementById('pville1').style.backgroundColor = "red"; return false; }else{ document.getElementById('pville1').style.backgroundColor = "white"; } // GENRE DE DEMANDE A RECEVOIR : ACHAT ou LOCATION //alert("precevoir_demande_location=" + document.getElementById('precevoir_demande_location').checked); //alert("precevoir_demande_achat=" + document.getElementById('precevoir_demande_achat').checked); if ( (document.getElementById('precevoir_demande_location').checked==false) && (document.getElementById('precevoir_demande_achat').checked==false) ){ alert('Veuillez indiquez le genre de demande qui vous interresse'); document.getElementById('precevoir_demande_achat').focus(); document.getElementById('precevoir_demande_achat').style.backgroundColor = "red"; return false; }else{ document.getElementById('precevoir_demande_achat').style.backgroundColor = "white"; } return true; }