Removed custom oninvalid handling and marked required fields in UI

This commit is contained in:
Francesco 2023-09-30 10:58:24 +02:00
parent 5b6dba0d24
commit 90da830030
2 changed files with 7 additions and 8 deletions

View File

@ -96,8 +96,7 @@
th:classAppend="${field.isPrimaryKey() && object != null ? 'disable' : ''}" th:classAppend="${field.isPrimaryKey() && object != null ? 'disable' : ''}"
th:required="${!field.isNullable() && !field.isPrimaryKey()}" th:required="${!field.isNullable() && !field.isPrimaryKey()}"
step="any" step="any"
oninvalid="this.setCustomValidity('This field is not nullable.')" >
oninput="this.setCustomValidity('')">
</th:block> </th:block>
<button class="ui-btn btn btn-primary"><i class="bi bi-search text-white"></i></button> <button class="ui-btn btn btn-primary"><i class="bi bi-search text-white"></i></button>
</div> </div>

View File

@ -32,6 +32,9 @@
<input type="hidden" name="__dbadmin_create" th:value="${create}"> <input type="hidden" name="__dbadmin_create" th:value="${create}">
<div th:each="field : ${schema.getSortedFields()}" class="mt-2"> <div th:each="field : ${schema.getSortedFields()}" class="mt-2">
<label th:for="|__id_${field.getName()}|" class="mb-1 fw-bold"> <label th:for="|__id_${field.getName()}|" class="mb-1 fw-bold">
<span th:if="${!field.isNullable() && !field.isPrimaryKey()}">
*
</span>
[[ ${field.getName()} ]] [[ ${field.getName()} ]]
</label> </label>
@ -52,9 +55,8 @@
" "
class="form-control" th:id="|__id_${field.getName()}|" class="form-control" th:id="|__id_${field.getName()}|"
th:required="${!field.isNullable() && !field.isPrimaryKey()}" th:required="${!field.isNullable() && !field.isPrimaryKey()}"
oninvalid="this.setCustomValidity('This field is not nullable.')"
rows="5" rows="5"
oninput="this.setCustomValidity('')"></textarea> ></textarea>
</th:block> </th:block>
<th:block th:if="${!field.isText()}"> <th:block th:if="${!field.isText()}">
<input th:if="${!field.isBinary()}" placeholder="NULL" th:type="${field.getType().getHTMLName()}" <input th:if="${!field.isBinary()}" placeholder="NULL" th:type="${field.getType().getHTMLName()}"
@ -67,8 +69,7 @@
th:classAppend="${field.isPrimaryKey() && object != null ? 'disable' : ''}" th:classAppend="${field.isPrimaryKey() && object != null ? 'disable' : ''}"
th:required="${!field.isNullable() && !field.isPrimaryKey()}" th:required="${!field.isNullable() && !field.isPrimaryKey()}"
step="any" step="any"
oninvalid="this.setCustomValidity('This field is not nullable.')" >
oninput="this.setCustomValidity('')">
</th:block> </th:block>
<!--/*--> Binary field <!--*/--> <!--/*--> Binary field <!--*/-->
@ -92,8 +93,7 @@
th:name="${field.getName()}" th:name="${field.getName()}"
class="form-control mt-2" th:id="|__id_${field.getName()}|" class="form-control mt-2" th:id="|__id_${field.getName()}|"
th:required="${!field.isNullable()}" th:required="${!field.isNullable()}"
oninvalid="this.setCustomValidity('This field is not nullable.')" >
oninput="this.setCustomValidity('')">
</th:block> </th:block>
</th:block> </th:block>
<div class="separator mt-3 mb-2 separator-light"></div> <div class="separator mt-3 mb-2 separator-light"></div>