CodeCharge Studio
search Register Login  

Web Reporting

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> ASP

 Validate Textbox against a Table

Print topic Send  topic

Author Message
kevkath


Posts: 4
Posted: 04/02/2007, 8:50 AM

I am trying to "Onvalidate" a textbox that contains a 5 digit zip code against another table that has a list of known zip codes. If the zip code that is not entered into the table I want the user to receive an error that they have entered a Invalid Zip Code. I have been unsuccessful so far. Can anyone offer some assistance?

After I get this resolved I am going to have it do the same lookup validation for phone area codes. I am using ASP and Microsoft Access for my database.

I am using a zip code database from http://www.zip-codes.com

Kevin
_________________
Kevin
View profile  Send private message
Wkempees
Posted: 04/02/2007, 11:50 AM

In theory, not ASP
do a CCDLookup() on the table holding the zipcodes.
Test for the result, any value is a hit, NULL will be a miss.
if your zipcode table has (id, zip) and is called ziptable
CCDLookup("id", "ziptable", "zip=" . textbox, $conn)

Of course you need the ASP equivalent of this pseudocode.
This whole thing you can stuff into a serverside validate.

Walter
kevkath


Posts: 4
Posted: 04/02/2007, 5:13 PM

Thanks Walter for your input. I appreciate you help. Your comments helped me to get to where I needed to be. My final working code is as entered. I hope it will help others in the future.

Kevin

OnValidate:

IF NOT CCDLookup("ZipCode","zip_data","ZipCode=" & DBtrailerdata.ToSQL(orderform.Zip_Code.Value , ccsText), DBtrailerdata) <> "" THEN
orderform.Errors.addError("You Have Entered An Invalid Zip Code Address. Please Check And Re-Enter")
ELSE
END IF




_________________
Kevin
View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

Internet Database

Visually create Web enabled database applications in minutes.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.