验证问题? [英] validation problem ?

查看:66
本文介绍了验证问题?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在页面上有2个文本框和2个按钮.1个文本框和1个按钮位于更新面板内部,而1个文本框和1个按钮位于更新面板外部.现在,当我按更新面板内部的按钮时,它仅应验证更新面板内部的文本框而不是外面的那个.当我在更新面板上按下按钮时,它应该验证两个文本框.请指导我该怎么做

i have 2 textboxes and 2 buttons on the page .1 textbox and 1 button is inside update panel and 1 textbox and 1 button is outside update panel .Now when i press button inside update panel it should only validate textbox inside update panel not the one outside .And when i press button outside update panel it should validate both the text boxes .Please guide me how to do it

推荐答案

function validateForm()
{
    var x = document.forms["myForm"]["Tex1"].value;
    var y = document.forms["myForm"]["text2"].value;
    
    if (x == null || x == "")
    {
        alert("Error");
        return false;
    }
    
    if (y == null || y == "")
    {
        alert("Error");
        return false;
    }
}


您应该为两个按钮都创建2个验证功能.
在第一个按钮上,验证1个文本框.
然后单击其他按钮,验证两个文本框.
You should create 2 validate function for both button.
on first button validate 1 textbox.
and on other button click validate both textboxes.


这篇关于验证问题?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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