Print Page | Close Window

form field validation needed

Printed From: ProductCart E-Commerce Solutions
Category: ProductCart
Forum Name: Suggestions
Forum Description: ProductCart Suggestions
URL: https://forum.productcart.com/forum_posts.asp?TID=3867
Printed Date: 22-November-2024 at 10:38am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: form field validation needed
Posted By: BrianRoden
Subject: form field validation needed
Date Posted: 20-July-2010 at 10:42am
Is there any way to get some basic field validation on the customer address entry pages? We're having issues with people putting N/A in the phone number field (which causes problems when the order data is imported into our AS/400 warehouse system). Sometimes people type their entire address, including city, state, and postal code, all in one address line.
 
If this was an ASP.net app, I could easily add the field validation .net components linked to the data fields. Does anybody have any mods they have done to make certain fields (like city, state, and zip) required, and to make sure phone numbers and e-mail addresses follow the right formats?



Replies:
Posted By: Greg Dinger
Date Posted: 20-July-2010 at 10:56am
Brian - the following post references some existing code that is used to dictate the fields that are required or not.  Refer to the file "pc/onepagecheckoutJS.asp".   Some of what you wish to do might already be there, and in that same area is where you may wish to introduce additional logic.
 
http://www.earlyimpact.com/forum/forum_posts.asp?TID=3678&KW=phone+required&PID=14258 - http://www.earlyimpact.com/forum/forum_posts.asp?TID=3678&KW=phone+required&PID=14258


-------------
GreyBeard Design Group

Certified ProductCart Developer

Web Design/Development/Hosting

http://tinyurl.com/5c8t4t" rel="nofollow - Add-Ons & Custom Code |


Posted By: Matt
Date Posted: 20-July-2010 at 12:05pm
I want to clarify for anyone reading this that ProductCart does validate form fields, including the address and city.  Validation for the postal code and state/province is conditional and based on the shopper's country.  The phone number field is also optional as Greg indicated above.   ProductCart uses the jQuery framework for validation and it can easily be expanded to perform any type of custom validation with support for regular expressions.


Posted By: BrianRoden
Date Posted: 20-July-2010 at 12:36pm
But even if we don't make the phone number a required field, shouldn't it be checking that only valid characters are used in that field? It should reject "N/A" (if it doesn't apply, just leave it blank). And a reasonable length check on each address line would be good (I don't know of any shipping label that allows more than 35-40 characters on one line -- our warehouse management system from Manhattan Associates has a 35-character max per address line).
 
We had someone order a book as a gift for a person in prison, and they put "Federal Correctional Institute P.O. Box xxxx yyyyy-zzz GN" all in the first address line (that last part is the inmate number). Now I realize part of that is just the customer not knowing how to enter the data correctly, but we would still like to warn them when the data is too long, and force them to re-think how they're keying it (use the company line and the second address line).
 
Can anyone offer suggestions on how to mod the checkout page's validation definitions to accomplish this? I'm a VB and .net guy. No Java experience other than copy/pasting some OnClick scripts.


Posted By: Matt
Date Posted: 20-July-2010 at 1:05pm
Here is a link to the validation documentation:

http://docs.jquery.com/Plugins/Validation

You will find that you can add phone number formatting around line 367.


In your case you may want to add your custom validation on the server side.  You can do so in the file "opc_updbilladdr.asp".  Since the checkout uses AJAX there will be no postback. So it will still be very effective.



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net