Where to change phone validator?


I amanaged to change the phone validator text, but where to i change the conditions for displaying the error messages?

Is it possible to also create a zip/postal code validator?

many thanks



I’m also trying to do it…

Hope to solve this issues…

The same goes for me.


I also interested

Me too. :grin: :grin:

look in…

[cs_cart] → js → core.js

this method:

phone: function(val)

lines 60 to 89 ish

I don’t beleive there is any validation done by the server/php but i could be wrong.

i submitted i nthe bugtracker a requesto to make phone mask user configurable, or to have the option to disable it… it is too strict for lots of users!

(i always hack core.js phone: function(val) to make it work)


I agree, it doesnt look good when it gives a US example and your not in the US.

so to disable US phone validation, in core.js, change this passage:

phone: function(val)


var digits = ‘0123456789’;

var valid_chars = ‘()- +’;

var min_digits = 10;

var bracket = 3;

var brchr = val.indexOf(‘(’);

var s = ‘’;

solution is to ex:

-reduce var min_digets if Norway has 8 digits

-set var bracket = 0; if Norway have no area codes?



Added comment to new users & novices like me: this seemed to solve it!! ;)

Also see the Knowledge Base article:

[url=“CS-Cart Documentation — CS-Cart 4.15.x documentation”]CS-Cart Documentation — CS-Cart 4.15.x documentation

  1. How do I change this function to validate phone numbers to allow only

    var digits = '0123456789';

    var valid_chars = '()- +';

    but in any format?

  2. I'd like to add the following note:

    Enter your phone number, following the recommended formats below:

    Australia: 2 digit area code - 8 digit phone number (Example: 02-1234-5678)

    Non Australia: country code - area code - phone number (Example: 61-2-1234 5678)

    How can I add this text?

    Thanks, Steve.

Did you get an answer to this,

I just want to disable it altogether, or even better, have it alert, but not stop the checkout process.

It would be good to have it customizable to suit different countries and dependent upon prefixes, but this is too much stuffing about. The KB2 gave some help as to disabling the validation but didnt show how to just make it a non-critical alert.