Validating Text field against database. 
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
| 
July 1st, 2009, 07:01 AM
|  | Moderator | | Join Date: Aug 2008 Location: Leipzig, Germany
Posts: 3,487
| | | re: Validating Text field against database. Quote:
Originally Posted by chandhseke 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 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 - <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>
| 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).
| 
July 1st, 2009, 10:05 AM
|  | Expert | | Join Date: Mar 2007
Posts: 10,634
| | | re: Validating Text field against database. Quote:
Originally Posted by Dormilich 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 ;-)
| 
July 1st, 2009, 10:42 AM
|  | Moderator | | Join Date: Aug 2008 Location: Leipzig, Germany
Posts: 3,487
| | | re: Validating Text field against database. Quote:
Originally Posted by JosAH 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 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 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
| 
July 1st, 2009, 01:51 PM
|  | 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
| 
July 1st, 2009, 02:41 PM
|  | 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.
| 
July 1st, 2009, 02:44 PM
|  | Moderator | | Join Date: Aug 2008 Location: Leipzig, Germany
Posts: 3,487
| | | re: Validating Text field against database. Quote:
Originally Posted by insertAlias otherwise, divs and css. | not to forget lists & CSS…
| 
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
| 
July 1st, 2009, 03:01 PM
|  | 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 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.
| 
July 1st, 2009, 03:54 PM
|  | 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.
| 
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
|  | | | | /bytes/about
We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights.
Get the best answers to your questions from over 225,662 network members.
|