feat: tooltip on url field, with message on validation

This commit is contained in:
HeshamTB 2023-09-13 13:57:56 +03:00
parent 13269a7b84
commit b19919399f
2 changed files with 4 additions and 2 deletions

View File

@ -15,7 +15,7 @@
<form hx-post="/download" hx-target="#get-btn" hx-swap="outerHTML" hx-indicator="#progress"> <form hx-post="/download" hx-target="#get-btn" hx-swap="outerHTML" hx-indicator="#progress">
<div class="grid"> <div class="grid">
<div hx-target="this" hx-swap="outerHTML"> <div hx-target="this" hx-swap="outerHTML">
<label>Link <label data-tooltip="Link can be on any platform!">Link
<input <input
type="url" id="URL" name="URL" type="url" id="URL" name="URL"
hx-post="/valid-link" hx-indicator="#url-validation-progress" required> hx-post="/valid-link" hx-indicator="#url-validation-progress" required>

View File

@ -1,5 +1,7 @@
<div hx-target="this" hx-swap="outerHTML"> <div hx-target="this" hx-swap="outerHTML">
<label> <label
data-tooltip="{{ if .Valid }}Link is Valid{{ else }}Link is invalid{{ end }}"
>
Link Link
<input name="URL" id="URL" type="url" hx-post="/valid-link" <input name="URL" id="URL" type="url" hx-post="/valid-link"
aria-invalid="{{ if .Valid }}false{{ else }}true{{ end }}" aria-invalid="{{ if .Valid }}false{{ else }}true{{ end }}"