Commit 98b638b1 authored by Siedschlag, Lennart's avatar Siedschlag, Lennart
Browse files

time und duration validation

parent 10247541
Pipeline #6278 passed with stage
in 4 minutes and 35 seconds
......@@ -15,10 +15,19 @@
resize: none;
}
#stern{
margin:6px;
font-size: 12px;
}
#delete {
color: red;
}
.invalid-feedback {
margin:6px;
}
label {
width: 100%;
}
......@@ -31,14 +31,30 @@
<div class="form-group">
<label for="time">Uhrzeit</label>
<input type="text" class="form-control" id="time" placeholder="00:00"
<input type="text" class="form-control" id="time"
pattern="(0[0-9]|1[0-9]|2[0-4])(:[0-5][0-9])"
placeholder="HH:MM"
#time="ngForm"
[class.is-valid]="time.valid"
[class.is-invalid]="!time.valid"
[(ngModel)]="appointment.time" ngControl="time">
<div [hidden]="time.valid || time.pristine" class="invalid-feedback">
Please follow the pattern HH:MM
</div>
</div>
<div class="form-group">
<label for="duration">Dauer</label>
<input type="text" class="form-control" id="duration" placeholder="00:00"
<input type="text" class="form-control" id="duration"
pattern="(0[0-9]|1[0-9]|2[0-4])(:[0-5][0-9])"
placeholder="HH:MM"
#duration="ngForm"
[class.is-valid]="duration.valid"
[class.is-invalid]="!duration.valid"
[(ngModel)]="appointment.duration" ngControl="duration">
<div [hidden]="duration.valid || duration.pristine" class="invalid-feedback">
Please follow the pattern HH:MM
</div>
</div>
<div class="form-group">
......
......@@ -31,14 +31,30 @@
<div class="form-group">
<label for="time">Uhrzeit</label>
<input type="text" class="form-control" id="time" placeholder="00:00"
<input type="text" class="form-control" id="time"
pattern="(0[0-9]|1[0-9]|2[0-4])(:[0-5][0-9])"
placeholder="HH:MM"
#time="ngForm"
[class.is-valid]="time.valid"
[class.is-invalid]="!time.valid"
[(ngModel)]="appointment.time" ngControl="time">
<div [hidden]="time.valid || time.pristine" class="invalid-feedback">
Please follow the pattern HH:MM
</div>
</div>
<div class="form-group">
<label for="duration">Dauer</label>
<input type="text" class="form-control" id="duration" placeholder="00:00"
<input type="text" class="form-control" id="duration"
pattern="(0[0-9]|1[0-9]|2[0-4])(:[0-5][0-9])"
placeholder="HH:MM"
#duration="ngForm"
[class.is-valid]="duration.valid"
[class.is-invalid]="!duration.valid"
[(ngModel)]="appointment.duration" ngControl="duration">
<div [hidden]="duration.valid || duration.pristine" class="invalid-feedback">
Please follow the pattern HH:MM
</div>
</div>
<div class="form-group">
......@@ -49,13 +65,13 @@
<div class="form-group">
<label for="note">Note: </label>
<textarea type="text" class="form-control" id="note" placeholder="note"
<textarea type="text" class="form-control" id="note" placeholder="note"
[(ngModel)]="appointment.note" name="note" rows="4"></textarea>
<div id="stern">
fields with a <b>*</b> are required
</div>
</div>
<div>
* fields are required
</div>
<button type="submit" [disabled]="!newAppointmentForm.form.valid" class="btn btn-success" (click)="create()">
Create
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment