大佬教程收集整理的这篇文章主要介绍了jquery – 在提交之前收听Semantic UI表单验证错误,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
@H_403_7@我可以阻止模态关闭的唯一方法是在提交按钮中添加一个禁用的类.
@H_403_7@我希望听取表格(实时)并根据当前表单验证状态打开和关闭禁用的类.@H_403_7@我只能在提交表单后才能使其工作,但不是实时的
@H_403_7@
$('#myForm') .form({ title: { identifier : 'title',rules: [ { type : 'empty',prompt : 'Please enter a title' },{ type : 'length[2]',prompt : 'at least 6 characters' } ] } },{ onsuccess: function() { $('#submit').removeClass('disabled'); },onFailure: function() { $('#submit').addClass('disabled'); } } );
@H_403_7@所以类似的东西:
@H_403_7@
$('.ui.modal').modal({ onApprove : function() { //Submits the semantic ui form //And pass the handling responsibilities to the form handlers,// e.g. on form validation success $('.ui.form').submit(); //Return false as to not close modal dialog return false; } }); var formValidationRules = { title: { identifier : 'title',rules: [ { type : 'empty',prompt : 'Please enter a title' },{ type : 'length[2]',prompt : 'at least 6 characters' } ] } } var formSetTings = { onsuccess : function() { //Hides modal on validation success alert("Valid Submission,modal will close."); $('.modal').modal('hide'); } } $('.ui.form').form(formValidationRules,formSetTings);@H_403_7@请注意,“OnApprove”事件仅在您单击“ok”类的模式按钮时触发.
<div class="ui ok green basic inverted button"> <i class="checkmark icon"></i> Submit </div>@H_403_7@这是我创建的扩展工作plunker代码,用于演示:
以上是大佬教程为你收集整理的jquery – 在提交之前收听Semantic UI表单验证错误全部内容,希望文章能够帮你解决jquery – 在提交之前收听Semantic UI表单验证错误所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。