I am new to PHP Codeigniter framework. I am designing a page in which I am using a link. On clicking the link it is calling a jquery function, which submits form through jquery. I have used codeigniter form validation methods for server side validation and for the timebeing I have disabled the client side validation.
Here if I click on the "Submit button of the form, then the codeigniter validation works for user-name and password fields. But if I click the link with id="login-submit", then it calls the jquery function and the form get submitted. But the codeigniter validation does not work for user-name and password fields this time.
I need to submit the form through the link and the codeigniter validation function should work for this.
我需要通过链接提交表单,并且codeigniter验证功能应该适用于此。
Thanks in Advance.....
提前致谢.....
2 个解决方案
#1
2
Use .preventDefault() instead of just returning false on the anchor click event.
使用.preventDefault()而不是仅在锚点击事件上返回false。
This has happened to me before and it seems to me that there is a conflict somewhere using .submit() inside a click event and returning false to stop the anchor's default behavior.