大家好,我没有得到如何删除另一个选项卡中的验证。如果有人知道这个答案,请帮助.. [英] Hi all ,I am not getting how to delete validation in another tab.If anybody know this answer please help..

查看:55
本文介绍了大家好,我没有得到如何删除另一个选项卡中的验证。如果有人知道这个答案,请帮助..的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在一个页面中有两个名为register和planning的选项卡。在Register页面中,我对某些Text框进行了ASP.NET MVC验证。在点击该页面的提交按钮时,我得到了正确的验证但是当我在Planning选项卡上选择时,我没有做任何验证,但点击提交时按钮,那时我在页面的上面得到验证错误消息。在规划页面我不给验证仍然我得到验证错误消息。为了隐藏我验证我使用下面的代码,但它无法正常工作。 />

There are two tabs named register and planning in one page. And in Register page I did ASP.NET MVC validation for some Text boxes.And while clicking on submit button of that page I am getting correct validation But when I am selecting on Planning tab there I have not done any validation but while clicking on submit button that time I am getting validation error message in the above of the page.And in Planning page I don't give validation still i am getting validation error message.For hiding I validation I used below code but it is not working.

$(document).ready(function () {
       $(#tabs).bind('change', function () {
           var value = $(this).val();
           alert(value);
           if (value == "tabs-1";) {
               $("#strWorkOrderPONo").rules("remove"); 
           }
           if (value == "tabs-2"{
               $("#strWorkOrderPONo").rules("add", "required");
           }
           return false;
       });

   });

strWorkOrderPONo是文本框ID,这里我做了验证

tabs-1用于Register和tabs-2用于Planning

strWorkOrderPONo is the text box id ,here i did validation
tabs-1 for Register and tabs-2 for Planning

推荐答案

document )。ready( function (){
(document).ready(function () {


(#tabs).bind(' change' function (){
var value =
(#tabs).bind('change', function () { var value =


this )。val();
alert(value);
if (value == tabs-1;){
(this).val(); alert(value); if (value == "tabs-1";) {

这篇关于大家好,我没有得到如何删除另一个选项卡中的验证。如果有人知道这个答案,请帮助..的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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