警报或消息框中的验证消息 [英] validation message in alert or message box

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

问题描述

朋友,

我正在为TextBox使用必需的字段验证器.

验证失败时是否可以在警报或消息框中显示错误消息?

请提供一些示例来帮助我的朋友们.

在此先感谢您.

Hi Friends,

I am using required field validator for a TextBox.

Is it possible to show error messages in an alert or message box when validation fails?

Please Help me friends by providing some sample.

Thanks in advance.

推荐答案

我假设您是在问问ASP.Net问题.对于必需的字段验证器,您将需要在表单本身中显示错误消息.它不能发出警报.如果您确实需要显示警报,最好去实现javascript.在单击按钮或类似操作时检查文本框的值,并显示警报.
I am assuming that you are asking your question w.r.t ASP.Net. For required field validator, you will need to show the error message in the form itself. It cannot come in alert. If you really need to show alerts, better go for implementing javascript. Check the textbox value on button click or similar and display an alert.


ValidationSummary[^] has an attribute for that.


这是一个示例代码 [ http://www.w3schools.com/js/default.asp [ JavaScript入门教程 [
Here is a Sample code[^]

Since you are new to javascript you might find the below links helpful.
http://www.w3schools.com/js/default.asp[^]

Javascript Beginner tutorial[^]


这篇关于警报或消息框中的验证消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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