如何使用不同的按钮验证多个文本框 [英] how to validate multiple text box with different buttons

查看:59
本文介绍了如何使用不同的按钮验证多个文本框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尊敬的先生,

我有5个文本框,分别为txt1,txt2,txt3,txt4和txt5.

我使用2个按钮,一个用于插入,一个用于在不同表中提交.


我的问题是如何在插入按钮上使用所有文本框验证,以及如何在提交按钮上使用两个texbox验证?



在此先感谢您,

Dear sir,

I have 5 text boxes, txt1, txt2, txt3, txt4 and txt5.

I use 2 buttons, one for insert and one for submit in different table.


My question is how to use all textbox validation on insert button and how to use two texbox validation on submit button?



thanks in advance,

推荐答案

JavaScript将为您服务.这是给你的提示

Javascript will work for you. here is hint for you

function ValidateTextboxes(objID)
{
   if(document.getElementById(objID).value == "Insert") //check if insert button press
   {
     //validate all textboxes
   }
   elseif(document.getElementById(objID).value=="Submit") //check if submit button pressed
   {
      //validate only 2 textboxes
   }
}



在onclient上调用上述函数单击带有ID作为参数的按钮



call above function on onclient click of button with id as parameters

<asp:button id="btnSubmit" runat="server" value="click me" onclientclick="ValidateTextboxes(this.id)" />


将按钮的Causesvalidation属性设为false
make it false for Causesvalidation property of the button


此链接对于该问题非常有用

如果您的iis版本低于服务器iis版本,请首先检查iis版本,然后点击此链接

http://blog.nkadesign .com/2008/windows-2008-the-microsoftjetoledb40-provider-is-not-registered-on-the-local-machine/ [
this link very useful for that problem

fist check iis version if your iis version is lower than the the server iis version then follow this link

http://blog.nkadesign.com/2008/windows-2008-the-microsoftjetoledb40-provider-is-not-registered-on-the-local-machine/[^]


这篇关于如何使用不同的按钮验证多个文本框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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