Why does the phone number on the customer register page have to be a certain length ?? It doesant take my phone number… Is this only set up for the U.S?? I cant see where this can be set in the back end. Does anyone have this problem
You can find the phone # validation routines in /js/core.js. You will need to modify the code there:
phone: function(val)
{
var digits = '0123456789';
var valid_chars = '()- +';
var min_digits = 10;
var bracket = 3;
var brchr = val.indexOf('(');
var s = '';
val=jQuery.trim(val);
if (val.indexOf('+') > 1) {
return false;
}
if (val.indexOf('-') != -1) {
bracket = bracket + 1;
}
if ((val.indexOf('(') != -1 && val.indexOf('(') > bracket) || (val.indexOf('(') != -1 && val.charAt(brchr + 4) != ')') || (val.indexOf('(') == -1 && val.indexOf(')') != -1)) {
return false;
}
for (var i = 0; i < val.length; i++) {
var c = val.charAt(i);
if (valid_chars.indexOf(c) == -1) {
s += c;
}
}
return (jQuery.is.integer(s) && s.length >= min_digits);
},
Bob
But that should be fixed in the CS-Cart script itself and not through some code modification.
[quote name=‘indy0077’]But that should be fixed in the CS-Cart script itself and not through some code modification.[/QUOTE]
I agree that it would be nice if we could specify valid formats for both postal codes and phones numbers on per-country basis. Unfortunately, right now, we have to modify the code.
Bob
Thanks Bob,
I think the phone number slot should have no requirements ?..
[quote name=‘abconeill’]Thanks Bob,
I think the phone number slot should have no requirements ?..[/quote]
That will not fix the problem with the validation…
[quote name=‘indy0077’]That will not fix the problem with the validation…[/QUOTE]
Yes it will, problem solved by elimination…
No need for phone number format validation!
[quote name=‘Struck’]Yes it will, problem solved by elimination…
No need for phone number format validation![/quote]
I meant when the customer put his phone # and it has less then 10 digits.
[quote name=‘indy0077’]I meant when the customer put his phone # and it has less then 10 digits.[/QUOTE]
I just believe that having validation of a phone number field will actually cause more harm than good, this is in the real world not a programmers world! :o
Let the customer enter what ever phone number details they choose to enter, including their personal extension, or make reference to it being a cell phone, etc.
If they are not smart enough to enter it correctly, then there is little we can do to help them…thus communication via email is the only alternative.
PS: Indy you must be getting instant email forum post notifications now, that has to make you happy!
[quote name=‘indy0077’]I meant when the customer put his phone # and it has less then 10 digits.[/QUOTE]
Ok, fine… Maybe if it Only validated for a minimum of 10 digits, and nothing else! That would be the best situation.
[quote name=‘Struck’]Ok, fine… Maybe if it Only validated for a minimum of 10 digits, and nothing else! That would be the best situation.[/quote]
Struck, Struck… I meant digits + signs *+~'#-_.:,;><|!°^"§$%&/{([)]=}?`´
Am I missing something?
[quote name=‘indy0077’]Struck, Struck… I meant digits + signs *+~'#-_.:,;><|!°^"§$%&/{([)]=}?`´
Am I missing something? :p[/QUOTE]
Actually, it appears that you have pretty much covered every possible combination there! :o
You have already started downing those beers haven’t you?
[quote name=‘Struck’]Actually, it appears that you have pretty much covered every possible combination there! :o
You have already started downing those beers haven’t you?[/quote]
A visionary… :rolleyes:
Whether they put those digits in or not (the customer) they obviously don’t want to give their telephone number.
Advocating removal of the logic entirely, might be better if it validates it after input for logical placement into DB?
[QUOTE]Whether they put those digits in or not (the customer) they obviously don’t want to give their telephone number.[/QUOTE]
Yes, good point.
I guess the worst case scenario in a situation like this is the customer will just enter something like 123-456-7890 which is fine with us, just tells us they don’t want to be contacted via phone…
I still think the overall best situation would be to validate a minimum of 10 digits and leave it as that.
[quote name=‘Struck’]I still think the overall best situation would be to validate a minimum of 10 digits and leave it as that.[/quote]
With the country code it should be fine, but how many customers put the prefix to their phone #? Most european phone # have still less then 10 digits.
[QUOTE]I meant when the customer put his phone # and it has less then 10 digits.[/QUOTE]
Then why did YOU suggest validating for 10 digits to begin with??
Get off the beer Indy, “why do you think they call it dope”? (American phrase) :o
BTW: My beverage of choice is called a “Coma” Mix equal parts of Irish Mist Whiskey & Baileys Irish Cream (Much, much healthier for you than Beer)!
[quote name=‘Struck’]Then why did YOU suggest validating for 10 digits to begin with??
Get off the beer Indy, “why do you think they call it dope”? (American phrase) :o[/quote]
My english is bad, I know that but what I meant is that:
The phone number validation should be less then 10 places and includes digits and signs which will be usually used by typing a phone number like -()/+ and there should be a notice which signs are allowed.
UPDATE: I’m not irish.
That becomes an issue depending on country you are selling to. ie
0424 156 948 = Australian Mobile Number
(03) 5996 2406 = Australian Phone Phone
1-321-360-xxxx = USA Number
But, as Indy mentioned 10 digits or less might be preferable I suggest removing all digits checks entirely, rather have the user not notified of the formatting/not required to make it “fit” in order to continue.
[quote name=‘JesseLeeStringer’]…I suggest removing all digits checks entirely, rather have the user not notified of the formatting/not required to make it “fit” in order to continue.[/quote]
I would say to remove the digit “lenght”…