我想幫助jquery validate插件。我用它來檢查加載文件的擴展名。當擴展名不好時,它會提示更改文件,如果格式正確,則會將其考慮在內。 該插件在我的代碼中運行良好。問題是,當我點擊提交按鈕繼續,當它是正確的文件,按鈕不起作用,我不能去下一頁。然而,我的網頁之間有鏈接。你能幫我嗎 ?Jquery驗證文件擴展插件
0
A
回答
0
<!DOCTYPE html>
<html dir="ltr"
lang="fr-FR"
xmlns:th="http://www.thymeleaf.org">
<head>
<meta http-equiv="X-UA-Compatible"
content="IE=10"/>
<meta http-equiv="Content-type"
content="text/html; charset=utf-8"/>
<meta http-equiv="Expires"
content="0"/>
<title th:text="${@environment.getProperty('spring.application.title') + ' - ' + serviceTitle} + ' - Livrer le DDX'"></title>
<link id="favicon"
type="image/vnd.microsoft.icon"
rel="shortcut icon"
href="images/favicon.ico"/>
<meta name="viewport"
content="width=device-width, initial-scale=1"/>
<link rel="stylesheet"
href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"/>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js" type="text/javascript"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" type="text/javascript"></script>
<link id="mainCSS" type="text/css" rel="stylesheet" href="css/mainBS.css"/>
<link id="workflowStageCSS" type="text/css" rel="stylesheet" href="css/workflow-stage.css"/>
<link id="uploadDDXCSS" type="text/css" rel="stylesheet" href="css/uploadDDX.css"/>
<script src="http://code.jquery.com/jquery-1.12.0.min.js"></script>
<script src="http://cdn.jsdelivr.net/jquery.validation/1.14.0/jquery.validate.min.js"></script>
<script src="https://cdn.jsdelivr.net/jquery.validation/1.16.0/additional-methods.min.js"></script>
</head>
<body> <div class="articleBody">
<form id="ddxForm" name="ddxForm" method="POST" enctype="multipart/form-data" th:action="${@environment.getProperty('server.context-path') + 'uploadDDX'}" >
<p class="ddx-block">
<label id="ddx-file-label"
for="ddx-file" class="ddx-file-label"
>Fichier matlab(*):</label> <input id="ddx-file"
type="file"
name="ddx-file"
class="ddx-file" th:required="true"/>
</p><div><hr />
<input id="ddx-next" name="ddx-next"
type="submit" value="Continuer >>"/> <hr /></div>
</form></div>
</article>
</section>
</section>
</section>
<script>
jQuery.validator.setDefaults({
debug:true,
success:"valid"
});
$("#ddxForm").validate({
rules:{
"ddx-file":{
required:true,
extension:"m"
}
}
});
</script>
</body>
</html>
0
從爲調試選項的文檔:https://jqueryvalidation.org/validate/#debug
啓用調試模式。如果爲true,則表單未提交,並且控制檯上會顯示某些 錯誤(將檢查是否存在window.console 屬性)。嘗試啓用表單時,只需提交 即可停止提交。
嘗試在測試失敗案例後從setDefaults方法中除去'debug:true'。
+0
感謝Chris C的建議。我只需要從setDefaults方法中刪除'debug:true'。 – John
相關問題
- 1. 擴展Joomla身份驗證插件
- 2. 驗證文件擴展只有當文件字段不是空的使用jQuery驗證插件
- 3. 驗證上傳的文件擴展名
- 4. Drupal:驗證文件擴展名嗎?
- 5. 驗證文件類型擴展
- 6. 在Symfony3上驗證文件擴展名
- 7. Symfony3中的文件擴展名驗證
- 8. jquery驗證插件
- 9. jquery驗證插件
- 10. JQuery驗證插件
- 11. jQuery驗證插件
- 12. jQuery驗證插件
- 13. jquery - 驗證插件
- 14. 擴展抽象jQuery插件
- 15. 動態擴展jQuery插件
- 16. 圖片文件jQuery驗證插件
- 17. jQuery驗證擴展上傳文件類型
- 18. jQuery驗證 - 如何不接受文件擴展名
- 19. 使用jQuery驗證插件進行文件上傳驗證
- 20. Jquery驗證插件和nyromodal插件
- 21. jQuery驗證插件:驗證複選框
- 22. jQuery驗證插件的逐步驗證
- 23. 驗證多選與jQuery驗證插件
- 24. jQuery的驗證插件 - 沒有驗證
- 25. JQuery驗證插件 - 無法驗證類
- 26. 驗證文件是它聲稱是它的文件擴展名
- 27. 驗證在Firefox中上傳文件的文件擴展名
- 28. 文件擴展名mod_rewrite會干擾驗證文件嗎?
- 29. jquery/javascript文件驗證2字符串compration(文件擴展名)失敗
- 30. JQuery驗證插件 - 驗證前/驗證過程中的事件
爲什麼你不能像這樣使用:。而不是簡單任務的驗證器。這將不允許用戶上傳文件比你指定 –
嗨約翰。請閱讀:[如何創建最小,完整和可驗證示例](https://stackoverflow.com/help/mcve)並相應地更新您的問題。 –