ASP脚本中的必填字段验证 [英] Required field validations in ASP Script

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

问题描述

大家好,

我需要帮助才能在ASP脚本中执行所需的字段验证.

例如:

用户名..........
密码..........

在这种情况下,如果用户名和密码为blanc,我应该显示错误消息
输入您的用户名"和输入您的密码".

由于使用ASP脚本,因此语法非常困难.
请提供建议.

Hi all,

I need help to perform required field validations in ASP script.

Eg:

Username ..........
Password ..........

In this , if the username and password are blanc ,I should display the error messages
"Enter your username" and "Enter yor password".

Since ASP script, the syntax are quite difficult .
Kindly provide suggestions.

推荐答案

Google显示了所有内容:

必填字段验证器教程 [
Google reveals all:

Required Field Validator Tutorial[^]


我建​​议您都使用Javascript进行验证或在表单reolad之后提交表单,检查值是否为空白显示消息.
I suggest you that either use Javascript for validation or submit the form after form reolad check if values are blank display message.


function validateForm()
{
var x=document.forms["myForm"]["username"].value;
var y=document.forms["myForm"]["password"].value;
if (x==null || x=="")
  {
  alert("Enter Username");
  return false;
  }
if (y==null || y=="")
  {
  alert("Enter Password");
  return false;
  }
}


这篇关于ASP脚本中的必填字段验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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