add client side checks for required form fields

matches server side validation behavior
This commit is contained in:
Jackson Chen 2023-09-24 21:13:56 +02:00 committed by Drew DeVault
parent 17f8b5115d
commit 4c4e19a958
8 changed files with 18 additions and 8 deletions

View File

@ -49,7 +49,8 @@
id="title"
name="title"
autofocus
value="{{ title or ticket.title or "" }}" />
value="{{ title or ticket.title or "" }}"
required />
{{valid.summary("title")}}
</div>
<div class="form-group">

View File

@ -234,6 +234,7 @@
id="label_id"
name="label_id"
class="form-control {{ valid.cls("label_id") }}"
required
>
<option value="">-- Pick one --</option>
{% for label in tracker.labels if label not in ticket.labels %}

View File

@ -90,6 +90,7 @@
autocomplete="off"
list="user-list"
value="{{username or ""}}"
required
/>
<datalist id="user-list">
{% for u in recent_users %}

View File

@ -22,7 +22,8 @@
id="name"
class="form-control {{valid.cls("name")}}"
value="{{ name or "" }}"
aria-describedby="name-help" />
aria-describedby="name-help"
required />
{{valid.summary("name")}}
</div>
<div class="form-group">

View File

@ -81,7 +81,8 @@
<input
type="file"
name="dump"
class="form-control {{valid.cls('dump')}}" />
class="form-control {{valid.cls('dump')}}"
required />
{{valid.summary("dump")}}
</div>
<button type="submit" class="btn btn-primary">

View File

@ -45,7 +45,8 @@
id="color"
name="color"
style="height: 2.2rem"
value="{{ valid.kwargs.color or label.color }}" />
value="{{ valid.kwargs.color or label.color }}"
required />
{{valid.summary("color")}}
</div>
</div>
@ -58,7 +59,8 @@
maxlength="2048"
id="name"
name="name"
value="{{ valid.kwargs.name or label.name }}" />
value="{{ valid.kwargs.name or label.name }}"
required />
{{valid.summary("name")}}
</div>
</div>

View File

@ -53,7 +53,8 @@
id="color"
name="color"
style="height: 2.2rem"
value="{{ color or "#ffffff" }}" />
value="{{ color or "#ffffff" }}"
required />
{{valid.summary("color")}}
</div>
</div>
@ -66,7 +67,8 @@
maxlength="2048"
id="name"
name="name"
value="{{ name or "" }}" />
value="{{ name or "" }}"
required />
{{valid.summary("name")}}
</div>
</div>

View File

@ -121,7 +121,8 @@
value="{{ title or "" }}"
{% if another %}
autofocus
{% endif %} />
{% endif %}
required />
{{valid.summary("title")}}
</div>
<div class="form-group">