043
This commit is contained in:
parent
50e671d132
commit
6c6e47ae1e
12
src/a3.nim
12
src/a3.nim
@ -412,7 +412,6 @@ import
|
||||
|
||||
"/validation/zip" -> post:
|
||||
var zip = ctx.urlForm["c_postal_zip"]
|
||||
echo zip
|
||||
var val: Validity
|
||||
if zip == "":
|
||||
val.message = "Zip is Required"
|
||||
@ -433,6 +432,17 @@ import
|
||||
val.class = "text-success"
|
||||
ctx.send sendEmail(email, val)
|
||||
|
||||
"/validation/phone" -> post:
|
||||
var phone = ctx.urlForm["c_phone"]
|
||||
var val: Validity
|
||||
if phone == "":
|
||||
val.message = "Phone is Required"
|
||||
val.class = "text-danger"
|
||||
else:
|
||||
val.message = ""
|
||||
val.class = "text-success"
|
||||
ctx.send sendPhone(phone, val)
|
||||
|
||||
"/contact" -> get:
|
||||
|
||||
var
|
||||
|
@ -192,10 +192,18 @@
|
||||
name="c_email_address"
|
||||
>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div
|
||||
class="col-md-6"
|
||||
hx-target="this"
|
||||
hx-swap="outerHTML"
|
||||
>
|
||||
<label for="c_phone" class="text-black">Phone <span class="text-danger">*</span></label>
|
||||
<label class="text-danger">{{phoneError}}</label>
|
||||
<input type="text" class="form-control" id="c_phone" name="c_phone" placeholder="Phone Number">
|
||||
{# <label class="text-danger">{{phoneError}}</label> #}
|
||||
<input type="text" class="form-control" id="c_phone"
|
||||
hx-post="/validation/phone"
|
||||
name="c_phone"
|
||||
placeholder="Phone Number"
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
@ -106,4 +106,21 @@ proc sendEmail*(email: string, input: Validity): string =
|
||||
value="{email}"
|
||||
>
|
||||
</div>
|
||||
"""
|
||||
|
||||
proc sendPhone*(phone: string, input: Validity): string =
|
||||
result = fmt"""
|
||||
<div
|
||||
class="col-md-12"
|
||||
hx-target="this"
|
||||
hx-swap="outerHTML"
|
||||
>
|
||||
<label for="c_phone" class="text-black">Phone <span class="text-danger">*</span></label>
|
||||
<label class="{input.class}">{input.message}</label>
|
||||
<input type="text" class="form-control" id="c_phone"
|
||||
hx-post="/validation/phone"
|
||||
name="c_phone"
|
||||
value="{phone}"
|
||||
>
|
||||
</div>
|
||||
"""
|
Loading…
Reference in New Issue
Block a user