Server Side form validation 3
This commit is contained in:
@ -5,6 +5,7 @@
|
||||
<div class="col">
|
||||
<h1 class="text-center mt-3">Make reservation</h1>
|
||||
|
||||
{{$res := index .Data "reservation"}}
|
||||
<!-- <form method="post" action="" class="needs-validation" novalidate> -->
|
||||
<form method="post" action="" class="" novalidate>
|
||||
<input type="hidden" name="csrf_token" value="{{.CSRFToken}}">
|
||||
@ -15,19 +16,27 @@
|
||||
<label class="text-danger">{{.}}</label>
|
||||
{{end}}
|
||||
<input type="text" name="first_name" id="first_name" class="form-control {{with .Form.Errors.Get "first_name"}} is-invalid {{end}}"
|
||||
required autocomplete="off">
|
||||
value="{{$res.FirstName}}" required autocomplete="off">
|
||||
</div>
|
||||
<div class="form-group mt-5">
|
||||
<label for="last_name">Last name:</label>
|
||||
<input type="text" name="last_name" id="last_name" class="form-control" required autocomplete="off">
|
||||
{{with .Form.Errors.Get "last_name"}}
|
||||
<label class="text-danger">{{.}}</label>
|
||||
{{end}}
|
||||
<input type="text" name="last_name" id="last_name" class="form-control {{with .Form.Errors.Get "last_name"}} is-invalid {{end}}"
|
||||
value="{{$res.LastName}}" required autocomplete="off">
|
||||
</div>
|
||||
<div class="form-group mt-5">
|
||||
<label for="email">Email:</label>
|
||||
<input type="email" name="email" id="email" class="form-control" required autocomplete="off">
|
||||
{{with .Form.Errors.Get "email"}}
|
||||
<label class="text-danger">{{.}}</label>
|
||||
{{end}}
|
||||
<input type="email" name="email" id="email" class="form-control {{with .Form.Errors.Get "email"}} is-invalid {{end}}"
|
||||
value="{{$res.Email}}" required autocomplete="off">
|
||||
</div>
|
||||
<div class="form-group mt-5">
|
||||
<label for="phone">Phone number:</label>
|
||||
<input type="text" name="phone" id="phone" class="form-control" required autocomplete="off">
|
||||
<input type="text" name="phone" id="phone" class="form-control" value="{{$res.Phone}}" autocomplete="off">
|
||||
</div>
|
||||
|
||||
<hr>
|
||||
|
Reference in New Issue
Block a user