Connecting Tech Pros Worldwide Help | Site Map

Validating Text field against database.

  #1  
Old June 30th, 2009, 02:53 PM
Member
 
Join Date: Jun 2009
Posts: 34
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
  #2  
Old July 1st, 2009, 07:01 AM
Dormilich's Avatar
Moderator
 
Join Date: Aug 2008
Location: Leipzig, Germany
Posts: 3,487

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).
  #3  
Old July 1st, 2009, 10:05 AM
JosAH's Avatar
Expert
 
Join Date: Mar 2007
Posts: 10,634

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 ;-)
  #4  
Old July 1st, 2009, 10:42 AM
Dormilich's Avatar
Moderator
 
Join Date: Aug 2008
Location: Leipzig, Germany
Posts: 3,487

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
  #5  
Old July 1st, 2009, 01:51 PM
JosAH's Avatar
Expert
 
Join Date: Mar 2007
Posts: 10,634

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
  #6  
Old July 1st, 2009, 02:41 PM
insertAlias's Avatar
Forum Leader
 
Join Date: Apr 2008
Location: San Antonio, TX (USA)
Posts: 2,569

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.
  #7  
Old July 1st, 2009, 02:44 PM
Dormilich's Avatar
Moderator
 
Join Date: Aug 2008
Location: Leipzig, Germany
Posts: 3,487

re: Validating Text field against database.


Quote:
Originally Posted by insertAlias View Post
otherwise, divs and css.
not to forget lists & CSS…
  #8  
Old July 1st, 2009, 02:57 PM
Member
 
Join Date: Jun 2009
Posts: 34

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
  #9  
Old July 1st, 2009, 03:01 PM
Dormilich's Avatar
Moderator
 
Join Date: Aug 2008
Location: Leipzig, Germany
Posts: 3,487

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.
  #10  
Old July 1st, 2009, 03:54 PM
insertAlias's Avatar
Forum Leader
 
Join Date: Apr 2008
Location: San Antonio, TX (USA)
Posts: 2,569

re: Validating Text field against database.


We do, however, have an ASP Classic Forum that you should visit.
  #11  
Old July 1st, 2009, 04:22 PM
Member
 
Join Date: Jun 2009
Posts: 34

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>


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to get both old and new value for a changed text box Kathy answers 31 October 3rd, 2006 03:15 PM
Validating: If the value EXISTS in Db then show error! pmud answers 5 November 19th, 2005 04:12 AM
Parser for CSV files Ali-R answers 25 November 16th, 2005 10:38 PM
Validating in asp with access Mats answers 3 July 19th, 2005 08:31 AM