If you're a web programmer or site designer, you have created a HTML form to collect data about users. These forms usually end up writing right to a database. However when you go to analyze the data, you realize that many users have typed in all 'X's or incorrectly entered the information. This becomes more of a problem when there is something behind the form, such as a free download or a restricted area, and the user receives the "prize" without having to fill in the form correctly. XCheck can significantly reduce this type of invalid data entry.
XCheck is a COM Object that can be used in Active Server pages to clean and check form data before it is written to a database. XCheck verifies addresses, cities, states, provinces, zip codes, and credit cards to make sure that the user's input is correct. XCheck allows the web programmer to instruct the server to ask the question many times until it is answered correctly. This way the user corrects his entries before the data ever gets written to the database.
It is easy to use XCheck in existing forms or use our example form to start collecting data right away.
, The XCheck component in this article has been acquired by Software Artisans from Sign Me Up Marketing. On acquisition the name of the product changed from XCheck to SA-Check and the ProgId also changed. However, the functionality described in the article for the most part is unchanged. You can find out more information at: http://www.softartisans.com/ .
Update
If you're a web programmer or site designer, you have created a HTML form to collect data about users. These forms usually end up writing right to a database. However when you go to analyze the data, you realize that many users have typed in all 'X's or incorrectly entered the information. This becomes more of a problem when there is something behind the form, such as a free download or a restricted area, and the user receives the "prize" without having to fill in the form correctly. XCheck can significantly reduce this type of invalid data entry.
XCheck is a COM Object that can be used in Active Server pages to clean and check form data before it is written to a database. XCheck verifies addresses, cities, states, provinces, zip codes, and credit cards to make sure that the user's input is correct. XCheck allows the web programmer to instruct the server to ask the question many times until it is answered correctly. This way the user corrects his entries before the data ever gets written to the database.
It is easy to use XCheck in existing forms or use our example form to start collecting data right away.
, The XCheck component in this article has been acquired by Software Artisans from Sign Me Up Marketing. On acquisition the name of the product changed from XCheck to SA-Check and the ProgId also changed. However, the functionality described in the article for the most part is unchanged. You can find out more information at: http://www.softartisans.com/ .
The XCheck Component verifies addresses, cities, states, provinces, countries, USA Zip codes and Canadian postal codes. XCheck can also verify that a Credit Card Number passes a Mod 10 check, and return the type of card from it's number. XCheck has methods to determine a valid first name, last name, and email address. Also included is low level verification, to see if a string in a number, and to determine is a string has a space, symbol, number or alpha character, for custom string parsing. XCheck can also count the number of words in a string to make sure that comment fields are not too long.
Street Address Verification
XCheck makes sure that street address is entered correctly in the web form. You can call IsValidAddress, passing in an address and XCheck will return True, or False. XCheck uses our patented address parser to validate the addresses. Address checking is as easy as the sample below:
XCheck = Server.CreateObject("SMUM.XCheck.1")
If XCheck.IsValidAddress("PO Box 5827") = True Then
' Write to the database
else
' Error Message
End If
If the address isn't correct, then you can call SuggestAddressChange passing in the bad address and XCheck will return a string with a suggestion for changes.
City Verification
XCheck will also verify that the city name is valid. You can call IsValidCity much like you would call IsValidAddress in the example above.
State Verification
XCheck verifies that the user has entered a valid state or mailing location. Besides the 50 states, valid mailing locations include military abbreviations. Calling IsValidState will check the state.
Besides checking the state, XCheck will return a collection of states that you can use in a SELECT drop down box. You can either get full State names by calling States, or State Initials by calling StateIntials. This functionality allows you to create forms quickly and accurately. Here is an example of using XCheck to create a SELECT drop down box in a form.
<%
XCheck = Server.CreateObject("SMUM.XCheck.1")
%>
<FORM ACTION="this.asp" METHOD=POST>
<SELECT NAME="State">
<%
For Each State in XCheck.States
%>
<OPTION><%=State%>
<%
Next State
%>
</SELECT>
</FORM>
Allowing the user to choose from a drop down list makes the form easier for them to fill out and gives you cleaner results to enter into your database.
Provincial Verification
XCheck can verify that the user has entered a valid province. You can call IsValidProvince much like IsValidState.
XCheck also contains a collection of provinces that you can use in a SELECT drop down box. Calling the property Provinces will return a collection of valid provinces. See the States example above for example code to use in your Active Server page.
Country Verification
XCheck can verify that the user has entered a valid country. XCheck can distinguish between over two hundred valid countries. Call the IsValidCountry the same way that you call IsValidProvince or IsValidState.
XCheck also contains a collection of countries that you can use in a SELECT drop down box. Calling the property Countries will return a collection of countries. See the States example above for example code to use in your Active Server page.
Postal Code Verification
XCheck can verify that the user has entered a valid Postal code for both the US and Canada. IsValidUSZipCode and IsValidCanadianZipCode can be called just like you would call IsValidAddress in the first example.
Credit Card Verification
All credit card numbers have a particular pattern that can be verified with an algorithm called "Mod 10". XCheck uses this algorithm to make sure that the credit card number is valid. XCheck has built-in functionality to check credit card numbers for validity. The function ValidCreditCardNumber will verify that the credit card number is valid. ValidCreditCardNumber does not check to make sure that there are sufficient funds in the user's account, nor does it verify that the credit card is overdrawn. Users can enter their credit card numbers with spaces, dashes, or without a delimiter.
By calling CreditCardTypeFromNumber, XCheck will return the type of Credit Card based on the credit card number, in the form of a string. This way you can make sure that the credit card number the user selects matches the credit card number entered.
Email Verification
You can verify that the user's email address has the correct syntax with XCheck. By calling IsValidEmail XCheck will check the syntax of the email address. This can be used much like IsValidAddress in the first example.
Name Verification
The method IsValidName can be used to check the syntax of a user's first or last name. This method checks for proper syntax, the presence of a vowel and the absence of symbols from the user's name. Here is some example code that can be added to an Active Server page to check a user's first name.
XCheck = Server.CreateObject("SMUM.XCheck.1")
If XCheck.IsValidName(Request.Form("FirstName")) = True Then
' Write to the database
else
' Error Message
End If
Low Level Verification
XCheck also allows you to do your own string parsing by providing low level checking of strings. HasSpace, HasAlpha, HasDigit, HasSymbol all return True if a string "has" a particular attribute. There is also a method called IsNumber, which verifies that the particular string is a number.
Counting Words
XCheck provides a method called CountWords that returns the number of words in a string. This method is useful for counting the number of words entered in a TEXTAREA to make sure that the user doesn't exceed a certain number.
Contained in the evaluation download is a file called XCheck.asp which has an example form that can be used on your web site.
Mailing List
Want to receive email when the next article is published? Just Click Here to sign up.