没有runat ="server"的html控件的requiredfieldvalidator. [英] requiredfieldvalidator to html control without runat="server"

查看:116
本文介绍了没有runat ="server"的html控件的requiredfieldvalidator.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我想在没有runat ="server"的情况下验证我的html文本框到requiredfieldvalidator.

谢谢,
krunal

hi all,

i want to validate my html text box without runat="server" to requiredfieldvalidator.

thanks,
krunal

推荐答案

无法使用RequiredFieldValidator验证HTML控件.如果只想验证HTML控件客户端,则需要使用JavaScript.

RequiredFieldValidator仅用于服务器控件.


--Amit
It''s not possible to validate a HTML control using RequiredFieldValidator. If you want to validate your HTML control client side only then you need to use JavaScript.

RequiredFieldValidator is used only for server controls.


--Amit


您好,您可以使用javascript验证html文本框:


Hi, you can validate your html text box with javascript:


<input name="tel" id="tel" type="text" size="20" maxlength="200" style="width: 200px;"  önblur="checkTelRequired(this);" /><label>*</label>
<label id="telRequired" style="display: none;">Required</label>


function checkRequired(whatYouTyped) {
     var txtTel = whatYouTyped.value;
     var telRequired = document.getElementById("telRequired");
     if (txtTel == "") {
         telRequired.style.display = "";
         return false;
     }
     else {
         telRequired.style.display = "none";
     }
     return true;
}


尝试此链接,
http://stackoverflow.com/questions/12065340/password-box-text [ ^ ]
Try this link,
http://stackoverflow.com/questions/12065340/password-box-text[^]


这篇关于没有runat ="server"的html控件的requiredfieldvalidator.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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