Bob, I don't know how to manage that. I'm brainless for coding.
What I know is just how to copy/paste the code Fasenderos suggested (shame on me)
Alert is on fields with "Ce champ ne doit pas rester vide, indiquer aucun si personne n\'est inscrit"
<?php
//count number of names separated by comma
$users = substr_count($form->data['participants_soiree_restaurant'], ',') + 1;
//number of adults
$adults = $form->data['total_soiree_restaurant_adultes'];
//number of childrens
$childrens = $form->data['total_restaurant_enfants'] ;
$error_count = 0;
if ( $form->data['participants_soiree_restaurant'] == '' ) {
$form->validation_errors['participants_soiree_restaurant'] = 'Ce champ ne doit pas rester vide, indiquer aucun si personne n\'est inscrit';
$error_count++;
} elseif ( $users != $adults + $childrens ) {
$form->validation_errors['total_soiree_restaurant_adultes'] = 'ATTENTION ! Restaurant - Le nombre total doit correspondre au nombre d\'inscrits';
$form->validation_errors['total_restaurant_enfants'] = 'ATTENTION ! Restaurant - Le nombre total doit correspondre au nombre d\'inscrits';
$error_count++;
}
if ( $error_count > 0) {
return false;
}
$users = substr_count($form->data['participants_coupe_ski'], ',') + 1;
//number of adults
$adults = $form->data['total_coupe_ski_adultes'];
//number of childrens
$childrens = $form->data['total_coupe_ski_enfants'] ;
$error_count = 0;
if ( $form->data['participants_coupe_ski'] == '' ) {
$form->validation_errors['participants_coupe_ski'] = 'Ce champ ne doit pas rester vide, indiquer aucun si personne n\'est inscrit';
$error_count++;
} elseif ( $users != $adults + $childrens ) {
$form->validation_errors['total_coupe_ski_adultes'] = 'ATTENTION ! Coupe ski - Le nombre total doit correspondre au nombre d\'inscrits';
$form->validation_errors['total_coupe_ski_enfants'] = 'ATTENTION ! Coupe ski - Le nombre total doit correspondre au nombre d\'inscrits';
$error_count++;
}
if ( $error_count > 0) {
return false;
}
$users = substr_count($form->data['participants_ski_seul'], ',') + 1;
//number of adults
$adults = $form->data['total_ski_seul_adultes'];
//number of childrens
$childrens = $form->data['total_ski_seul_enfants'] ;
$error_count = 0;
if ( $form->data['participants_ski_seul'] == '' ) {
$form->validation_errors['participants_ski_seul'] = 'Ce champ ne doit pas rester vide, indiquer aucun si personne n\'est inscrit';
$error_count++;
} elseif ( $users != $adults + $childrens ) {
$form->validation_errors['total_ski_seul_adultes'] = 'ATTENTION ! Ski - Le nombre total doit correspondre au nombre d\'inscrits';
$form->validation_errors['total_ski_seul_enfants'] = 'ATTENTION ! Ski - Le nombre total doit correspondre au nombre d\'inscrits';
$error_count++;
}
if ( $error_count > 0) {
return false;
}
$users = substr_count($form->data['participants_buffet'], ',') + 1;
//number of adults
$adults = $form->data['total_buffet_adultes'];
//number of childrens
$childrens = $form->data['total_buffet_enfants'] ;
$error_count = 0;
if ( $form->data['participants_buffet'] == '' ) {
$form->validation_errors['participants_buffet'] = 'Ce champ ne doit pas rester vide, indiquer aucun si personne n\'est inscrit';
$error_count++;
} elseif ( $users != $adults + $childrens ) {
$form->validation_errors['total_buffet_adultes'] = 'ATTENTION ! Buffet - Le nombre total doit correspondre au nombre d\'inscrits';
$form->validation_errors['total_ski_seul_enfants'] = 'ATTENTION ! Buffet - Le nombre total doit correspondre au nombre d\'inscrits';
$error_count++;
}
if ( $error_count > 0) {
return false;
}
$users = substr_count($form->data['participants_soiree_restau'], ',') + 1;
//number of adults
$adults = $form->data['total_buffet_adultes'];
//number of childrens
$childrens = $form->data['total_buffet_enfants'] ;
$error_count = 0;
if ( $form->data['participants_soiree_restau'] == '' ) {
$form->validation_errors['participants_soiree_restau'] = 'Ce champ ne doit pas rester vide, indiquer aucun si personne n\'est inscrit';
$error_count++;
} elseif ( $users != $adults + $childrens ) {
$form->validation_errors['total_soiree_restau_adultes'] = 'ATTENTION ! Restaurant samedi - Le nombre total doit correspondre au nombre d\'inscrits';
$form->validation_errors['total_soiree_restau_enfants'] = 'ATTENTION ! Restaurant samedi - Le nombre total doit correspondre au nombre d\'inscrits';
$error_count++;
}
if ( $error_count > 0) {
return false;
}
?>