ProductCart E-Commerce Solutions Homepage
Forum Home Forum Home > ProductCart > Suggestions
  New Posts New Posts RSS Feed - form field validation needed
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

form field validation needed

 Post Reply Post Reply
Author
Message
BrianRoden View Drop Down
Groupie
Groupie


Joined: 07-September-2007
Status: Offline
Points: 0
Post Options Post Options   Thanks (0) Thanks(0)   Quote BrianRoden Quote  Post ReplyReply Direct Link To This Post Topic: form field validation needed
    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?
Back to Top
Greg Dinger View Drop Down
Certified ProductCart Developers
Certified ProductCart Developers
Avatar

Joined: 23-September-2006
Location: United States
Status: Offline
Points: 238
Post Options Post Options   Thanks (0) Thanks(0)   Quote Greg Dinger Quote  Post ReplyReply Direct Link To This Post 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.
 
Back to Top
Matt View Drop Down
Moderator Group
Moderator Group


Joined: 20-July-2006
Location: United States
Status: Offline
Points: 73
Post Options Post Options   Thanks (0) Thanks(0)   Quote Matt Quote  Post ReplyReply Direct Link To This Post 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.
Back to Top
BrianRoden View Drop Down
Groupie
Groupie


Joined: 07-September-2007
Status: Offline
Points: 0
Post Options Post Options   Thanks (0) Thanks(0)   Quote BrianRoden Quote  Post ReplyReply Direct Link To This Post 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.
Back to Top
Matt View Drop Down
Moderator Group
Moderator Group


Joined: 20-July-2006
Location: United States
Status: Offline
Points: 73
Post Options Post Options   Thanks (0) Thanks(0)   Quote Matt Quote  Post ReplyReply Direct Link To This Post 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.
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.031 seconds.