SimpleForm+ClientSideValidations+bootstrap - Validation is not occuring on the form- all inputs are accepted

心不动则不痛 提交于 2019-12-04 04:23:30

All the logic gets applied to forms with visible inputs. Since your inputs are not visible on page load, no events are attached.

The following worked for me:

$('#myModal').on('shown', function () {
  $(ClientSideValidations.selectors.forms).validate();
});

The README actually details a more specific function to do this:

$(new_form).enableClientSideValidations();

https://github.com/bcardarella/client_side_validations#enabling

On newer bootstrap versions:

$('#myModal').on('shown.bs.modal', function () {
  $(ClientSideValidations.selectors.forms).validate();
});
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!