Connecting Tech Pros Worldwide Help | Site Map

Validating Text field against database.

Member
 
Join Date: Jun 2009
Posts: 37
#1: Jun 30 '09
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
Dormilich's Avatar
Moderator
 
Join Date: Aug 2008
Location: Leipzig, Germany
Posts: 3,629
#2: Jul 1 '09

re: Validating Text field against database.


Quote:

Originally Posted by chandhseke View Post

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#.

sounds like a job for AJAX

Quote:

Originally Posted by chandhseke View Post

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

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

Quote:

Originally Posted by chandhseke View Post

Expand|Select|Wrap|Line Numbers
  1. <tr> 
  2.     <td bordercolor="#FFFFFF" bgcolor="#333399"> <div align="center"><font color=#FFFFFF 
  3.       size=2 face="Verdana, Arial, Helvetica, sans-serif"><strong>PeopleSoft ID</strong></font></div></td>
  4.     <td bordercolor="#FFFFFF"> <input maxlength=6 size=13 name=ID />
  5.         </td>
  6. </tr>

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).
JosAH's Avatar
Expert
 
Join Date: Mar 2007
Posts: 10,611
#3: Jul 1 '09

re: Validating Text field against database.


Quote:

Originally Posted by Dormilich View Post

tables should not be used for layout (that's the job of CSS).

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 ;-)
Dormilich's Avatar
Moderator
 
Join Date: Aug 2008
Location: Leipzig, Germany
Posts: 3,629
#4: Jul 1 '09

re: Validating Text field against database.


Quote:

Originally Posted by JosAH View Post

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.

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.

Quote:

Originally Posted by JosAH View Post

I always happily use tables to display data in tabular form ...

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

Quote:

Originally Posted by JosAH View Post

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.

the ultimate resource of CSS 2.1 (aka TechSpec)

comprehensive look-up site (german) ← well organized and compact
JosAH's Avatar
Expert
 
Join Date: Mar 2007
Posts: 10,611
#5: Jul 1 '09

re: Validating Text field against database.


Thanks for the links (I put them in my bookmarks already ;-) The first link gave me the clue: by using divs I can get a similar look as with those tables; it's nice. For real tabular data I'll use tables otherwise I use those divs with their css layout tags.

kind regards,

Jos
insertAlias's Avatar
Forum Leader
 
Join Date: Apr 2008
Location: San Antonio, TX (USA)
Posts: 2,603
#6: Jul 1 '09

re: Validating Text field against database.


Yeah, that's what I've learned Jos. Tables are not for layout anymore. Real, tabled data goes in them, otherwise, divs and css. Apparently one big difference is properly laid out HTML/CSS with divs rather than tables is much more search-engine-optimizable.
Dormilich's Avatar
Moderator
 
Join Date: Aug 2008
Location: Leipzig, Germany
Posts: 3,629
#7: Jul 1 '09

re: Validating Text field against database.


Quote:

Originally Posted by insertAlias View Post

otherwise, divs and css.

not to forget lists & CSS…
Member
 
Join Date: Jun 2009
Posts: 37
#8: Jul 1 '09

re: Validating Text field against database.


But my question is different..Let me make a long story into short : I am working as a Support and Maintenance enginner for web applications..This a new requirement from our customers.. We are using ASP classic, JavaScript and VB script.. In one of our applications, when the employee enters thier Employee_ID they need to check this against database for the availabilty as the employees FAT fingured few times and the records created with wrong EMp_ID's.. So as soon the Employee enters thier ID in the text box, it should check against a database table ESH..Any suggestions would be appreciated,,

Many Thanks
Dormilich's Avatar
Moderator
 
Join Date: Aug 2008
Location: Leipzig, Germany
Posts: 3,629
#9: Jul 1 '09

re: Validating Text field against database.


well, to cite me again…

Quote:

Originally Posted by Dormilich View Post

sounds like a job for AJAX

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

unfortunately, I can't help you with ASP and VB script.
insertAlias's Avatar
Forum Leader
 
Join Date: Apr 2008
Location: San Antonio, TX (USA)
Posts: 2,603
#10: Jul 1 '09

re: Validating Text field against database.


We do, however, have an ASP Classic Forum that you should visit.
Member
 
Join Date: Jun 2009
Posts: 37
#11: Jul 1 '09

re: Validating Text field against database.


Thanks for your kind help on guiding me to the correct point..

Many thanks
Reply

Tags
<form>, <option>, <script>, <select>