chore: Better form errors

This commit is contained in:
Jan K9f 2025-09-03 07:20:57 +02:00
commit 4d10e10cf3
Signed by: jank
GPG key ID: 22BEAC760B3333D6

View file

@ -88,13 +88,16 @@
<div formGroupName="email">
<h5 class="mt-3">Email</h5>
@if (this.emailGroup.errors) {
@if (this.emailGroup.errors && this.emailGroup.touched) {
<p class="text-danger">The emails do not match</p>
}
<div class="row">
<div class="col-md-6 mb-3">
<label for="email" class="form-label">Email</label>
@if (this.emailGroup.controls["email"].invalid) {
@if (
this.emailGroup.controls["email"].invalid &&
this.emailGroup.controls["email"].touched
) {
@if (this.emailGroup.controls["email"].errors!["required"]) {
<p class="text-danger">Email is required</p>
}
@ -113,7 +116,10 @@
<label for="confirmEmail" class="form-label"
>Confirm Email</label
>
@if (this.emailGroup.controls["confirmEmail"].invalid) {
@if (
this.emailGroup.controls["confirmEmail"].invalid &&
this.emailGroup.controls["confirmEmail"].touched
) {
@if (
this.emailGroup.controls["confirmEmail"].errors!["required"]
) {
@ -137,13 +143,16 @@
<div formGroupName="password">
<h5 class="mt-3">Password</h5>
@if (this.passwordGroup.errors) {
@if (this.passwordGroup.errors && this.passwordGroup.touched) {
<p class="text-danger">The passwords do not match</p>
}
<div class="row">
<div class="col-md-6 mb-3">
<label for="password" class="form-label">Password</label>
@if (this.passwordGroup.controls["password"].invalid) {
@if (
this.passwordGroup.controls["password"].invalid &&
this.passwordGroup.controls["password"].touched
) {
@if (
this.passwordGroup.controls["password"].errors!["required"]
) {
@ -161,7 +170,10 @@
<label for="confirmPassword" class="form-label"
>Confirm Password</label
>
@if (this.passwordGroup.controls["confirmPassword"].invalid) {
@if (
this.passwordGroup.controls["confirmPassword"].invalid &&
this.passwordGroup.controls["confirmPassword"].touched
) {
@if (
this.passwordGroup.controls["confirmPassword"].errors![
"required"