Bla*_*ess 1 html javascript forms jquery spring
所以我有一个带有多个按钮的表单,每个按钮在控制器中都有一个Request映射。
所以我想停止表单的双重提交,但是单击后我无法禁用该按钮,因为控制器无法获取它需要知道的信息。这是我得到的错误:
org.springframework.web.bind.UnsatisfiedServletRequestParameterException: Parameter conditions "update" OR "verify" OR "reject" OR "updateCard" OR "approve" OR "withdraw" OR "updateStatusToReject" OR "updateStatusToApprove" not met for actual request parameters:
Run Code Online (Sandbox Code Playgroud)
因此,我觉得单击后将按钮设为只读可以解决此问题。
到目前为止,我已经尝试过了,但是仍然允许重复提交。
$('.sendButton').click(function(){
$(this).prop('readonly', true);
});
<c:if test="${requestForm.status == 'R'}">
<input type="submit" name="updateStatusToApprove" value="Update To Approved" tabindex="7"
class="sendButton" id="appealA"/>
</c:if>
<c:if test="${requestForm.status == 'A' || requestForm.status == 'AA'}">
<input type="submit" name="updateStatusToReject" value="Update To Rejected" tabindex="8"
class="sendButton" id="appealR"/>
Run Code Online (Sandbox Code Playgroud)
关于如何在不实际禁用按钮的情况下停止重复提交的任何想法。
让你输入的类型 button
,并指定一个click
只执行一次使用处理一个
$('.sendButton').one( "click", function(){
//submit the form
$(this).closest('form').submit();
});
Run Code Online (Sandbox Code Playgroud)
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<input type="button" name="updateStatusToReject" value="Update To Rejected" tabindex="8" class="sendButton" id="appealR"/>
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
4526 次 |
最近记录: |