Telephone Number Checking

Wizzud

No avatar

2005-04-26 16:10

This seems to be causing all sorts of problems.
I've looked into the possibility of a plugin to help solve it but to implement the plugin you would have to edit more files than you would if you simply changed the regular expression used in the checks.
So, for anyone who is still having problems with the accepted format of telephone numbers there are 2 files that need changing:

js/checkForm.js:
On roughly line 40 replace
poprawnyTelefon = /^[0-9() -+]{7,}$/i;
with
poprawnyTelefon = /^[+]?((([0-9]+)[ ]?)|([0-9]+[ +-]?)){6,}$/i;

core/other.php:
On roughly line 93 replace
if( eregi( "^[0-9() -+]{7,}$", $sTel ) )
with
if( eregi( "^[+]?((([0-9]+)[ ]?)|([0-9]+[ +-]?)){6,}$", $sTel ) )

The above regular expression will allow:
- an optional leading '+'
- bracketed digits (eg. '+(44)....') optionally followed by a space (' ')
- groups of digits optionally separated by single occurences of either a space (' '), a hyphen ('-'), or a plus ('+')

It is not all-encompassing but I think it covers most formats that people have complained about. Use it or leave it as you see fit.

[Disabling the telephone number check altogether has already been explained (scattered over a couple of topics) in the forum, but basically you need to remove the javascript array entry for sTelephone in orders_delivery.tpl and remove the call to checkTel in orders.php.]

Knert

No avatar

2005-04-27 12:58

Hi Wizzud,

Many thnx for the time to try out some adjustments.

Unfortenately it still is not working. The same story as always: In a very few cases it works, but filling out the same (or other) telephone-data again, you get the same message over and over again: all forms are not filled out correctly.

To double check it again: I totally unzipped the version 3.0. ONLY changed the 2 lines as mentioned above, and it still get the same results.

The same thing with disabling too. It works for 1 out of 10 cases.

So changing the script, or adding, deleting stuff is not the solution.

May be the cookiething is a problem too.

Sincerly


Knert

Wizzud

No avatar

2005-04-27 18:00

Knert, do you have a test site I can see?

rubdub

No avatar

2005-04-29 21:46

What if you want phone number to be optional?

Wizzud

No avatar

2005-04-30 08:56

rubdub ...

Bengan

No avatar

2005-05-17 20:52

I had the same problem with the '-' in my telephonenumber (like 012-345678), but Wizzud's trix with the js/checkForm.js and core/other.php did it.
Thanx alot dude!

Wizzud

No avatar

2005-05-24 08:17

Slight modification: I looked at my initial post above and realised that some brackets shoudl have been represented as escaped (with backslashes) and weren't for some reason. So I'l try to post them again, correctly this time! I've also added in the use of a forward slash as a delimiter.

js/checkForm.js:
On roughly line 40 replace
poprawnyTelefon = /^[0-9() -+]{7,}$/i;
with
poprawnyTelefon = /^[+]?((([0-9]+)[ ]?)|([0-9]+[ /+-]?)){6,}$/i;

core/other.php:
On roughly line 93 replace
if( eregi( "^[0-9() -+]{7,}$", $sTel ) )
with
if( eregi( "^[+]?((([0-9]+)[ ]?)|([0-9]+[ /+-]?)){6,}$", $sTel ) )

The above regular expression will allow:
- an optional leading '+'
- bracketed digits (eg. '+(44)....') optionally followed by a space (' ')
- groups of digits optionally separated by single occurences of either a space (' '), a forward slash ('/'), a hyphen ('-'), or a plus ('+')

Wizzud

No avatar

2005-05-24 08:18

test : ((\)9\/0)

Wizzud

No avatar

2005-05-24 08:23

FINAL VERSION!!!!!!!!

Slight modification: I looked at my initial post above and realised that some brackets should have been represented as escaped (with backslashes) and weren't for some reason. So I'l try to post them again, correctly this time! I've also added in the use of a forward slash as a delimiter.

js/checkForm.js:
On roughly line 40 replace
poprawnyTelefon = /^[0-9() -+]{7,}$/i;
with
poprawnyTelefon = /^[+]?((\([0-9]+\)[ ]?)|([0-9]+[ \/+-]?)){6,}$/i;

core/other.php:
On roughly line 93 replace
if( eregi( "^[0-9() -+]{7,}$", $sTel ) )
with
if( eregi( "^[+]?((\([0-9]+\)[ ]?)|([0-9]+[ /+-]?)){6,}$", $sTel ) )

The above regular expression will allow:
- an optional leading '+'
- bracketed digits (eg. '+(44)....') optionally followed by a space (' ')
- groups of digits optionally separated by single occurences of either a space (' '), a forward slash ('/'), a hyphen ('-'), or a plus ('+')

Note for anyone else trying to get a backslash to display in the forum text fields - escape it with another backslash!

Wizzud

No avatar

2005-05-24 08:24

Thats better!

zandmanneke

No avatar

2005-07-01 14:22

Thanks! I should have searched the forum better for this solution, it would have saved me a night of agony! LOL

Great solution!

Ray Floyds

No avatar

2005-07-01 14:34

LoL ;-)

www.quickcart.nl Dutch Support Site

Back to top
about us | contact