【发布时间】:2021-06-02 18:17:08
【问题描述】:
我正在使用 th:disabled 并且它正在禁用按钮但仍然可以点击,这是我到目前为止所做的 thymeleaf 代码。 当用户完成申请的最终提交时,我想禁用文件上传按钮。为此,我正在检查这种情况: th:disabled="${lst.finalSubmit !=null}"
这是截图:(https://prnt.sc/10cny2t)
<div class="card-body" id="myDIV" onblur="chekforblank()">
<table id="TblGrievance" class="table table-striped table-bordered"
style="width: 100%">
<thead>
<tr class="bg-secondary">
<!-- <th>Sn.</th> -->
<th>Reference Number</th>
<th>Grievance Date</th>
<th>Phone NO</th>
<th>Status</th>
<th>Action</th>
<!-- <th> </th> -->
</tr>
<tr th:each="lst : ${dto}" id="ll">
<th th:text="${lst.refno}"></th>
<th th:text="${lst.finalSubmit}"></th>
<th th:text="${lst.phoneOfOrg}"></th>
<th th:text="${lst.complaintStatus}"></th>
<td>
<a th:href="@{/uploadDraft/{id}(id=${lst.refno})}" title="You have already Uplaoded your docmuents"><button
class="btn btn-primary" th:disabled="${lst.finalSubmit !=null}">File Upload</button></a>
<a th:href="@{/viewComplaint/{refno}(refno=${lst.refno})}"><i
class="fa fa-list-alt fa-2x" aria-hidden="true"></i></a></td>
</thead>
<tbody>
</tbody>
</table>
</div>
【问题讨论】:
-
我不确定您所说的“它正在禁用按钮但仍可点击”是什么意思。如果您的意思是当您将鼠标悬停在按钮上时光标会改变形状,那么您可以使用合适的样式来控制它 - 例如:
<button class="btn btn-primary" disabled="true" style="cursor: auto;">File Upload</button>。作为 CSS 类而不是嵌入式样式会更好 - 但这是一个快速演示。如果这不是你的意思,那么你能edit你的问题并澄清问题吗?
标签: javascript java spring-boot thymeleaf