Commit f382a475 authored by Nathan Peraldi's avatar Nathan Peraldi

fix error that make unable to see errors in contact form

parent 926df6ec
......@@ -4,6 +4,31 @@
Template Name: Formulaire d'adhésion
*/
$errors = array(
//Liste des éléments pouvant avoir une erreur
"first selection" => "",
"second Selection" => "",
"EPCI com" => "",
"EPCI hab" => "",
"nom" => "",
"adresse" => "",
"CP" => "",
"ville" => "",
"tel" => "",
"site" => "",
"periode" => "",
"siret" => "",
"numeroEngagement" => "",
"code" => ""
);
$debug_mode = false;
$resultat = false;
//on vérifie si un formulaire est entrant
$numberOfErrors = 0;
if (isset($_POST)) {
......@@ -40,25 +65,6 @@ if (isset($_POST)) {
}
}
$errors = array(
//Liste des éléments pouvant avoir une erreur
"first selection" => "",
"second Selection" => "",
"EPCI com" => "",
"EPCI hab" => "",
"nom" => "",
"adresse" => "",
"CP" => "",
"ville" => "",
"tel" => "",
"site" => "",
"periode" => "",
"siret" => "",
"numeroEngagement" => "",
"code" => ""
);
//le dossier où se trouvent les fichiers
$workingDirectory = $_SERVER["CONTEXT_DOCUMENT_ROOT"] . '/wp-content/themes/theme-wordpress-adullact-org/';
......@@ -66,9 +72,7 @@ $grillePath = $workingDirectory . 'grille.csv';
$periodSelectionPath = $workingDirectory . "periodSelection.php";
$JSPath = '/wp-content/themes/theme-wordpress-adullact-org/adhesionForm.js';
$debug_mode = false;
$resultat = false;
function createFirstSelectionList($liste)
{
......@@ -262,10 +266,16 @@ function tryToSetInputSelect($key, $value)
function tryToShowError($var)
{
global $errors;
global $errors, $debug_mode;
if (strlen($errors[$var]) > 0) {
echo "<p class='error'> " . $errors[$var] . "</p>";
}
else{
if($debug_mode){
echo "pas d'erreur : " . $errors[$var];
}
}
}
......@@ -321,16 +331,12 @@ sort($textsSelectMenuExtended);
sort($classSelectMenu);
sort($classSelectMenuExtended);
get_header();
?>
<div class="wrap">
<div id="primary" class="content-area">
<main id="main" class="site-main" role="main">
<h1>Formulaire de renouvellement d'adhésion</h1>
<p>
<?php
......@@ -388,8 +394,6 @@ get_header();
<p id="paraSecondSelection">
<?php
//on génère les labels
generateLabelCotisations(); ?>
......@@ -415,26 +419,38 @@ get_header();
</div>
<div id="informationsCollectivite">
<h3>Informations obligatoires :</h3>
<label for="nomCollectivite">Nom de la collectivité :</label>
<h3>Coordonnées :</h3>
<p>Les champs portant une astérisque
<abbr class="adullact-abbr" title="Champ obligatoire">*</abbr>
sont obligatoires
</p>
<label for="nomCollectivite">
<abbr class="adullact-abbr" title="Champ obligatoire">*</abbr>
Nom de la collectivité :
</label>
<input type="text" name="nomCollectivite" id="nomCollectivite" required=""
value="<?php tryToEcho("nomCollectivite"); ?>"><br>
<?php tryToShowError("nom"); ?>
<label for="adresseCollectivite">Adresse :</label>
<label for="adresseCollectivite">
<abbr class="adullact-abbr" title="Champ obligatoire">*</abbr>
Adresse :</label>
<input type="text" name="adresseCollectivite" id="adresseCollectivite" required=""
value="<?php tryToEcho("adresseCollectivite"); ?>"><br>
<?php tryToShowError("adresse"); ?>
<label for="codePostalCollectivite">Code postal :</label>
<label for="codePostalCollectivite">
<abbr class="adullact-abbr" title="Champ obligatoire">*</abbr>
Code postal :</label>
<input type="text" name="codePostalCollectivite" id="codePostalCollectivite" required=""
value="<?php tryToEcho("codePostalCollectivite"); ?>"><br>
<?php tryToShowError("CP"); ?>
<label for="villeCollectivite">Ville :</label>
<label for="villeCollectivite">
<abbr class="adullact-abbr" title="Champ obligatoire">*</abbr>
Ville :</label>
<input type="text" name="villeCollectivite" id="villeCollectivite" required=""
value="<?php tryToEcho("villeCollectivite"); ?>"><br>
<?php tryToShowError("ville"); ?>
......@@ -450,7 +466,10 @@ get_header();
value="<?php tryToEcho("siteCollectivite"); ?>"><br>
<?php tryToShowError("site"); ?>
<label for="periodeAdhesionCollectivite">Période d'adhésion :</label>
<label for="periodeAdhesionCollectivite">
<abbr class="adullact-abbr" title="Champ obligatoire">*</abbr>
Période d'adhésion :</label>
<select name="periodeAdhesionCollectivite" id="periodeAdhesionCollectivite" required="">
<option class="optionPeriod" value="" selected>---</option>
<?php generateDates(); ?>
......@@ -462,19 +481,28 @@ get_header();
<h3>Informations relatives à Chorus Pro</h3>
<label for="siretCollectivite">SIRET :</label>
<label for="siretCollectivite">
<abbr class="adullact-abbr" title="Champ obligatoire">*</abbr>
SIRET :
</label>
<input type="number" name="siretCollectivite" id="siretCollectivite" required=""
value="<?php tryToEcho("siretCollectivite"); ?>"><br>
<?php tryToShowError("siret"); ?>
<label for="numeroEngagementCollectivite">N° d'engagement :</label>
<label for="numeroEngagementCollectivite">
<abbr class="adullact-abbr" title="Champ obligatoire">*</abbr>
N° d'engagement :
</label>
<input type="text" name="numeroEngagementCollectivite" id="numeroEngagementCollectivite"
required=""
value="<?php tryToEcho("numeroEngagementCollectivite"); ?>"><br>
<?php tryToShowError("numeroEngagement"); ?>
<label for="codeCollectivite">Code :</label>
<label for="codeCollectivite">
<abbr class="adullact-abbr" title="Champ obligatoire">*</abbr>
Code :
</label>
<input type="text" name="codeCollectivite" id="codeCollectivite" required=""
value="<?php tryToEcho("codeCollectivite"); ?>"><br>
<?php tryToShowError("code"); ?>
......@@ -484,7 +512,6 @@ get_header();
<input type="submit" id="boutonEnvoyer">
</form>
<script type="text/javascript" src="<?php echo $JSPath ?>"></script>
<script>
......@@ -494,8 +521,4 @@ get_header();
</div>
</div>
<?php
get_footer();
?>
\ No newline at end of file
<?php get_footer(); ?>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment