1
0
forked from ScoDoc/ScoDoc

amélioration formulaires ajout correspondants

This commit is contained in:
Arthur ZHU 2022-06-09 20:52:50 +02:00
parent 434e571a98
commit e2c5a19655
3 changed files with 18 additions and 4 deletions

View File

@ -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

View File

@ -129,4 +129,9 @@
#form-entreprise-filter > label {
margin-right: 20px;
}
.title-form {
font-weight: bold;
color: #a94442
}

View File

@ -17,6 +17,9 @@
<form method="POST" action="" novalidate>
{{ form.hidden_tag() }}
{% for subfield in form.correspondants %}
{% if form.correspondants.errors %}
<p class="help-block title-form">Formulaire Correspondants-{{ loop.index-1 }}</p>
{% endif %}
{% for subsubfield in subfield %}
{% if subsubfield.errors %}
{% for error in subsubfield.errors %}