I am learning the JQuery Mobile framewrok and is using VS 2013 for my new project. I created a MVC 4 JQuery Mobile project. From the project I got out of the box, I click on the Login link and on that login page, I click on the Login Button, it shows the expected error messages. I want my project to be ajax enabled so I set the $.mobile.ajaxEnabled = true; and debug in VS, it hits the break point I set in the Login action in the AccountController so the client-side validation didn't work and got to the post on the server-side.
我正在学习JQuery Mobile framewrok,并在我的新项目中使用VS 2013。我创建了一个MVC 4 JQuery Mobile项目。从项目中我开箱即用,我点击登录链接,在登录页面上,我点击登录按钮,它显示了预期的错误消息。我希望我的项目启用ajax,所以我设置$ .mobile.ajaxEnabled = true;并在VS中进行调试,它会触及我在AccountController中的Login操作中设置的断点,因此客户端验证不起作用并进入服务器端的帖子。
Is it by design that I can't use the built-in client-side validation when ajaxEnabled is set to true? Or is there some settings that I need to set? I need my project to be jax enabled and would like to use the built-in client side validation if possible and don't have to write custom jquery validation code.
当ajaxEnabled设置为true时,我是否无法使用内置的客户端验证?或者是否需要设置一些设置?我需要我的项目启用jax,并希望尽可能使用内置的客户端验证,而不必编写自定义jquery验证代码。
1 个解决方案
#1
Found the answer. add the below code to the on pageshow event
找到了答案。将以下代码添加到pageshow事件中
$.validator.unobtrusive.parse(".ui-page-active form");
#1
Found the answer. add the below code to the on pageshow event
找到了答案。将以下代码添加到pageshow事件中
$.validator.unobtrusive.parse(".ui-page-active form");