From a7046f82312c5a537ca2fb8076f2eaa3fe8b42cf Mon Sep 17 00:00:00 2001 From: Alix JEUDI--LEMOINE Date: Fri, 30 May 2025 00:16:19 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=A6=BA=20Validate=20fields=20Titre/Locali?= =?UTF-8?q?sation/Description=20on=20edit=20modal?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../edit-pin-popup/edit-pin-popup.component.html | 11 +++++++++++ .../edit-pin-popup/edit-pin-popup.component.ts | 9 +++++---- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/src/app/components/edit-pin-popup/edit-pin-popup.component.html b/src/app/components/edit-pin-popup/edit-pin-popup.component.html index a04c735..9f944f7 100644 --- a/src/app/components/edit-pin-popup/edit-pin-popup.component.html +++ b/src/app/components/edit-pin-popup/edit-pin-popup.component.html @@ -97,6 +97,10 @@ aria-label="Edit" placeholder="Mont Saint-Michel" required /> +
+ Le titre est requis + Le titre doit contenir au moins 3 caractères +
@@ -114,6 +118,9 @@ aria-label="Edit" (focus)="onFocus()" (blur)="onBlur()" /> +
+ La localisation est requise +
diff --git a/src/app/components/edit-pin-popup/edit-pin-popup.component.ts b/src/app/components/edit-pin-popup/edit-pin-popup.component.ts index 8a769f0..bc042ed 100644 --- a/src/app/components/edit-pin-popup/edit-pin-popup.component.ts +++ b/src/app/components/edit-pin-popup/edit-pin-popup.component.ts @@ -12,6 +12,7 @@ import { FormControl, FormGroup, ReactiveFormsModule, + Validators, } from '@angular/forms'; import { NavigationEnd, Router } from '@angular/router'; import { forkJoin, of, Subscription } from 'rxjs'; @@ -68,10 +69,10 @@ export class EditPinPopupComponent implements OnInit, OnDestroy { ) { // Initialiser le formulaire avec des valeurs par défaut this.form = this.fb.group({ - title: new FormControl(''), - description: new FormControl(''), - location: new FormControl(''), - complete_address: new FormControl(''), + title: new FormControl('', [Validators.required, Validators.minLength(3)]), + description: new FormControl('', [Validators.required, Validators.minLength(3)]), + location: new FormControl('', [Validators.required]), + complete_address: new FormControl('', [Validators.required]), coordinates: new FormControl([]), files: new FormControl(null), date: new FormControl(''),