根据数据库验证文本字段。 [英] Validating Text field against database.

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

问题描述

我使用ASP经典开发了一个网页,我使用VBScript进行数据库连接...... Web应用程序工作正常,但我现在正在研究一个新的增强要求,我需要验证输入的ID#用户对新数据库的文本框。一旦用户输入他的ID#,就会发生此验证。


一旦用户输入ID#,它应该检查数据库表中ID#的可用性,如果它不存在消息应该弹出说输入无效的ID号


这是您的评论代码。


< TR>

< td bordercolor =" #FFFFFF" BGCOLOR = QUOT;#333399"> < DIV对齐= QUOT;中心"><字体颜色=#FFFFFF

大小= 2面= QUOT;宋体,Arial字体,黑体,无衬线"><强> PeopleSoft的ID< /强>< /字体>< / DIV>< / TD>

将TD BORDERCOLOR ="#FFFFFF"> < input maxlength = 6 size = 13 name = ID />

< / td>

< / tr>


在上面的示例代码片段中,我们需要对数据库添加验证。这个验证应该在表单提交之前开心

I have developed a web page using ASP classic, I am using VBScript for database connectivity... The web application is working fine, but i am now working on a new enhancement requirement where i need to validate the ID# entered into a text box by the users against a new database. This validation should happen as soon as the User enters his ID#.

Once the user enters the ID#, it should check the availabity of the ID# in the database table, if it does not exists a Message should pop up saying "Invalid ID number entered"

Here is the code for your review.

<tr>
<td bordercolor="#FFFFFF" bgcolor="#333399"> <div align="center"><font color=#FFFFFF
size=2 face="Verdana, Arial, Helvetica, sans-serif"><strong>PeopleSoft ID</strong></font></div></td>
<td bordercolor="#FFFFFF"> <input maxlength=6 size=13 name=ID />
</td>
</tr>

In the above sample code snippet, we need to add validation against database..And this validation should happpen before the form submission

推荐答案

<强> @chandhseke


听起来像是AJAX的工作

@chandhseke


是不是如果你和表格提交一起进行验证那么悲惨吗?

@chandhseke


你的HTML已经过时了。 < font> tag已经被弃用了几十年(感觉就像),并且应该引用每个属性值。 (真正的XHTML否则会出错)并且表格不应该用于布局(这是CSS的工作)。
@chandhseke
sounds like a job for AJAX

@chandhseke
would it be that tragic, if you do the validation along with the form submission?

@chandhseke
your HTML is horribly out of date. the <font> tag is deprecated for decades (feels like) now and every attribute value should be quoted. (real XHTML will error out otherwise) and tables should not be used for layout (that''s the job of CSS).


@Dormilich


注意详细说明?我知道(差不多)关于html和css的内容,但我不得不在html中编写一些文档。我总是高兴地使用表格以表格形式显示数据...我所知道的是css能够摆弄边框,标题,表格的相对大小......我在w3schools找不到合适的东西。


亲切的问候,


Jos


ps。抱歉打扰这个帖子; - )
@Dormilich
Care to elaborate on that? I know (almost) nothing about html and css but I have to write some documentation in html now and then. I always happily use tables to display data in tabular form ... all I knew was that css is able to fiddle with the borders, captions, relative sizes of the tables ... I can''t find anything appropriate in the w3schools either.

kind regards,

Jos

ps. sorry for intruding this thread ;-)


@JASAH


页面布局的表格是在CSS支持时使用的浏览器稀疏(80年代和90年代初)。所以表格(带有 border =" 0" )用于将所有元素放置到位,就像网格一样。


缺点是,标记-up既不是语义的,也不是可读的(尽管它的大小要大得多,最终你需要支付流量和渲染速度)。


但是现在CSS得到广泛支持(或多或少也在 * cough * IE中)所有的定位和眼睛糖果都可以使用CSS完成。



结帐 ALA的入门第2部分第1部分),你应该找到一些有用的资源。或者就此问题询问drhowarddrfine或David Laakso(及其他一些HTML / CSS专家)。

@JASAH


我不放有问题的是,如果你有表格数据,表格是可行的方法。

@JASAH
CSS 2.1的终极资源(又名TechSpec)

综合查询网站(德语)←组织良好且紧凑
@JosAH
tables for page layout were used when the CSS support of the browsers was sparse (80s and early 90s). so tables (with border="0") were used to put all elements in place, like a grid.

the disadvantage is, that the mark-up is neither semantic, nor readable (despite being much larger in size, which eventually you have to pay with traffic costs and rendering speed).

but now that CSS is widely supported (more or less also in *cough* IE) all the positioning and eye candy can be done using CSS.


check out ALA''s Primer Part 2 (Part 1), there you should find some useful resources. or ask drhowarddrfine or David Laakso (and some other HTML/CSS experts) on this matter.

@JosAH
I do not put that in question, if you have tabular data, tables are the way to go.

@JosAH
the ultimate resource of CSS 2.1 (aka TechSpec)

comprehensive look-up site (german) ← well organized and compact


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

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