form field validation needed |
Post Reply |
Author | |
BrianRoden
Groupie Joined: 07-September-2007 Status: Offline Points: 0 |
Post Options
Thanks(0)
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?
|
|
Greg Dinger
Certified ProductCart Developers Joined: 23-September-2006 Location: United States Status: Offline Points: 238 |
Post Options
Thanks(0)
|
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.
|
|
Matt
Moderator Group Joined: 20-July-2006 Location: United States Status: Offline Points: 73 |
Post Options
Thanks(0)
|
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.
|
|
BrianRoden
Groupie Joined: 07-September-2007 Status: Offline Points: 0 |
Post Options
Thanks(0)
|
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.
|
|
Matt
Moderator Group Joined: 20-July-2006 Location: United States Status: Offline Points: 73 |
Post Options
Thanks(0)
|
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. |
|
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |