diff --git a/app/entreprises/forms.py b/app/entreprises/forms.py index c564b24d4..61d517b7c 100644 --- a/app/entreprises/forms.py +++ b/app/entreprises/forms.py @@ -471,6 +471,7 @@ 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 @@ -690,7 +691,7 @@ class TaxeApprentissageModificationForm(FlaskForm): class EnvoiOffreForm(FlaskForm): responsables = FieldList( - _build_string_field( + StringField( "Responsable (*)", render_kw={ "placeholder": "Tapez le nom du responsable de formation", @@ -703,6 +704,8 @@ class EnvoiOffreForm(FlaskForm): def validate(self): validate = True + list_select = True + if not FlaskForm.validate(self): validate = False @@ -718,8 +721,12 @@ class EnvoiOffreForm(FlaskForm): .first() ) if responsable is None: - entry.errors.append("Champ incorrect (selectionnez dans la liste)") - validate = False + validate, list_select = False, False + + if list_select is False: + self.responsables.errors.append( + "Champ incorrect (selectionnez dans la liste)" + ) return validate diff --git a/app/static/css/entreprises.css b/app/static/css/entreprises.css index 14c8f2103..45d3f7629 100644 --- a/app/static/css/entreprises.css +++ b/app/static/css/entreprises.css @@ -131,7 +131,7 @@ margin-right: 20px; } -.title-form { +.title-form-error { 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 487916038..fd0fe64b0 100644 --- a/app/templates/entreprises/ajout_correspondants.html +++ b/app/templates/entreprises/ajout_correspondants.html @@ -16,9 +16,10 @@

{{ form.hidden_tag() }} + {{ form.correspondants.label }} {% for subfield in form.correspondants %} - {% if form.correspondants.errors %} -

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

+ {% if subfield.errors %} +

Formulaire {{ subfield.label.text }}

{% endif %} {% for subsubfield in subfield %} {% if subsubfield.errors %} @@ -59,7 +60,22 @@ } let newFieldName = `correspondants-${Math.max(...correspondantInputIds) + 1}`; allCorrepondantsFieldWrapper.insertAdjacentHTML('beforeend',` -
  • Retirer ce correspondant
  • +
  • + + + + + + + + + + + +
    + +
    Retirer ce correspondant
    +
  • `); }); } diff --git a/app/templates/entreprises/envoi_offre_form.html b/app/templates/entreprises/envoi_offre_form.html index 6ead6477d..e8f2d55e1 100644 --- a/app/templates/entreprises/envoi_offre_form.html +++ b/app/templates/entreprises/envoi_offre_form.html @@ -18,13 +18,9 @@

    {{ form.hidden_tag() }} - {{ form.responsables.label }}
    - {% for subfield in form.responsables %} - {% if subfield.errors %} - {% for error in subfield.errors %} -

    {{ error }}

    - {% endfor %} - {% endif %} + {{ form.responsables.label }} + {% for error in form.responsables.errors %} +

    {{ error }}

    {% endfor %} {{ form.responsables }}
    @@ -71,7 +67,11 @@ } let newFieldName = `responsables-${Math.max(...responsableInputIds) + 1}`; allResponsablesFieldWrapper.insertAdjacentHTML('beforeend',` -
  • Retirer
  • +
  • + + +
    Retirer
    +
  • `); var as_r = new bsn.AutoSuggest(newFieldName, responsables_options); });