一步一步的问题与&QUOT确认;返回]按键 [英] step by step problem with validation on "back" button

查看:130
本文介绍了一步一步的问题与&QUOT确认;返回]按键的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有,我绑定了对具有DataAnnotation一个视图模型的每一步一个3个步骤的形式。当我点击我的previous按钮,一切正常,只是罚款,验证被调用,如果有缺失值,用户必须填写所有必填字段。如果我有一个动作的链接去了,那么数据将不会被保留。我正在寻找在这里是一个办法救我的价值观,而不调用验证。我也考虑使用Cookie,但我不认为这是做的最好的方法。

I have a 3 steps forms where I bind for each step on a ViewModel that has DataAnnotation. Everything works fine except that when I click on my "previous" button, the validation gets called and, if there's missing values, the user has to fill all required fields. If I go with an action link, then the data won't be persisted. What I'm looking for here is a way to save my values without calling the validation. I also consider using cookies but I don't think that it's the best way of doing it.

任何意见或建议?

推荐答案

好很多搜索后,我发现对具有像精灵多种形式与previous和Next按钮,一个解决方案,将无法调用客户端验证从数据诠释和MicrosoftMvcValidation.js。我发现这个职位:<一href=\"http://stackoverflow.com/questions/203844/jquery-validation-plugin-disable-validation-for-specified-submit-buttons\">jQuery验证插件:指定禁用验证提交按钮女巫只是一个类添加到提交按钮,但它不是为我工作,所以我再次查看,发现这一个:的 http://forums.asp.net/p/1622628/4165648.aspx 女巫的解决在JavaScript为我工作:的document.getElementById(someButton)disableValidation = TRUE; 我想preFER一个jQ​​uery的解决方案,所以我可以做一些与我的按钮的类属性,但它的工作为今天,我已经花了太多。 mutch时间在这。

Ok after lots of searching I found out a solution for having a Wizard like multiple forms with previous and next buttons that won't call the client validation from Data Annotation and MicrosoftMvcValidation.js. I found this post : jQuery Validation plugin: disable validation for specified submit buttons witch simply add a class to the submit button but it was not working for me so I look again and found this one : http://forums.asp.net/p/1622628/4165648.aspx witch has a solution working for me in javascript : document.getElementById("someButton").disableValidation = true; I would prefer a jQuery solution so I could do something with the class attribute of my buttons but it's working for today and I've spent too mutch time on this.

希望它可以帮助一些人谁是试图做一个取消按钮或向导像MVC2形式,并希望对表单张贴到控制器,所以他需要明确的验证。

Hope it helps some else who's trying to do a "Cancel" button or a Wizard like forms in MVC2 and want's to post the form to the controller so he needs to clear the validation.

这篇关于一步一步的问题与&QUOT确认;返回]按键的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆