From e2c5a19655992911b1fbebe08a47fe268fa89853 Mon Sep 17 00:00:00 2001 From: Arthur ZHU Date: Thu, 9 Jun 2022 20:52:50 +0200 Subject: [PATCH] =?UTF-8?q?am=C3=A9lioration=20formulaires=20ajout=20corre?= =?UTF-8?q?spondants?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/entreprises/forms.py | 14 ++++++++++---- app/static/css/entreprises.css | 5 +++++ .../entreprises/ajout_correspondants.html | 3 +++ 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/app/entreprises/forms.py b/app/entreprises/forms.py index a129c7228..c564b24d4 100644 --- a/app/entreprises/forms.py +++ b/app/entreprises/forms.py @@ -348,8 +348,16 @@ class CorrespondantCreationForm(FlaskForm): validators=[DataRequired(message=CHAMP_REQUIS)], render_kw={"class": "form-control"}, ) - nom = _build_string_field("Nom (*)", render_kw={"class": "form-control"}) - prenom = _build_string_field("Prénom (*)", render_kw={"class": "form-control"}) + nom = StringField( + "Nom (*)", + validators=[DataRequired('Le champ "Nom" est requis')], + render_kw={"class": "form-control"}, + ) + prenom = StringField( + "Prénom (*)", + validators=[DataRequired('Le champ "Prénom" est requis')], + render_kw={"class": "form-control"}, + ) telephone = _build_string_field( "Téléphone (*)", required=False, render_kw={"class": "form-control"} ) @@ -379,7 +387,6 @@ class CorrespondantCreationForm(FlaskForm): if not self.telephone.data and not self.mail.data: msg = "Saisir un moyen de contact (mail ou téléphone)" self.telephone.errors.append(msg) - self.mail.errors.append(msg) validate = False return validate @@ -464,7 +471,6 @@ class CorrespondantModificationForm(FlaskForm): if not self.telephone.data and not self.mail.data: msg = "Saisir un moyen de contact (mail ou téléphone)" self.telephone.errors.append(msg) - self.mail.errors.append(msg) validate = False return validate diff --git a/app/static/css/entreprises.css b/app/static/css/entreprises.css index 203b3aeba..14c8f2103 100644 --- a/app/static/css/entreprises.css +++ b/app/static/css/entreprises.css @@ -129,4 +129,9 @@ #form-entreprise-filter > label { margin-right: 20px; +} + +.title-form { + font-weight: bold; + color: #a94442 } \ No newline at end of file diff --git a/app/templates/entreprises/ajout_correspondants.html b/app/templates/entreprises/ajout_correspondants.html index 18070b7fc..487916038 100644 --- a/app/templates/entreprises/ajout_correspondants.html +++ b/app/templates/entreprises/ajout_correspondants.html @@ -17,6 +17,9 @@
{{ form.hidden_tag() }} {% for subfield in form.correspondants %} + {% if form.correspondants.errors %} +

Formulaire Correspondants-{{ loop.index-1 }}

+ {% endif %} {% for subsubfield in subfield %} {% if subsubfield.errors %} {% for error in subsubfield.errors %}