close ad
WARNING: Do Not Install the DREAMWEAVER CC 2017 or 2018 Update »
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

UK Phone formating and validiation

Thread began 6/29/2010 11:13 am by aladdin229745 | Last modified 7/07/2010 3:29 pm by aladdin229745 | 8042 views | 11 replies |

aladdin229745

UK Phone formating and validiation

Does anyone use form builder in the UK.

When I enter a UK number it is formatted like this 0 (139) 234-1888
It should be 01392 431 888. Obviously it is not passing validiation either.

I had a look at the SpryValidationTextField.js

'phone_number': {
formats: {
//US phone number; 10 digits
'phone_us': {
pattern:'(000) 000-0000'
},
'phone_custom': {}
}
},

I have changed to

'phone_number': {
formats: {
//US phone number; 10 digits
'phone_us': {
pattern:'(000) 000-0000'
},
'phone_custom': {
pattern:'00000 000000'
}
}
},

But no luck, also in the UK some numbers are 10 and some 11.

Please can someone tell me how to set this up.

Many thanks

Sign in to reply to this post

Jason ByrnesWebAssist

find the line that initializes the phone spry validation.

It will look likle:
var Registration_group_Phone_Spry = new Spry.Widget.ValidationTextField("Registration_group_Phone_Spry", "phone_number", { format:'phone_us' , validateOn:["blur"]});


and change it to use your custom pattern:
var Registration_group_Phone_Spry = new Spry.Widget.ValidationTextField("Registration_group_Phone_Spry", "phone_number", { format:'phone_custom' ,pattern:"00000 000 000", validateOn:["blur"]});


In the patern, you can change the last character to a '?' to allow any character, the will need to enter a space for at the end of the 10 digit phone number. for example:
pattern:"00000 000 00?"

would allow the phone number to be enter as "12345 123 12 " or "12345 123 123"

Sign in to reply to this post

aladdin229745

Hi Jason
Thanks for your reply.
Am I to look in SpryValidationTextField.js for these lines. Because I cannot find them in there.

Sign in to reply to this post

Jason ByrnesWebAssist

no, near the bottom of the form page, there will be a script block that contains a line to initialize each spry form element.


The name of the spry variable will be different on your page, if you need help finding it, post a copy of your page.

Sign in to reply to this post

aladdin229745

Hi Jason,
Thanks, I have found the code and changed it as you have recommended. However, I am still having the same problem. You can check it out from this link and also see the source code.
form.html

I appriciate your help.


Aladdin

Sign in to reply to this post

Jason ByrnesWebAssist

client validation is also applied to the fild causingthe issue..
change:

php:
<input id="Appointment_request_group_Phone" name="Appointment_request_group_Phone" type="text" value="" class="formTextfield_Large" tabindex="5"  onblur="WAValidatePN(document.getElementById('AppointmentRequest_Brassy_Default').Appointment_request_group_Phone,'',false,true,'x (xxx) xxx-xxxx',document.getElementById('AppointmentRequest_Brassy_Default').Appointment_request_group_Phone,0,true);"/>




to:

php:
<input id="Appointment_request_group_Phone" name="Appointment_request_group_Phone" type="text" value="" class="formTextfield_Large" tabindex="5"  />
Sign in to reply to this post

aladdin229745

Hi Jason,
Thanks again. This sorted some of the problem but not all.
If you enter 11111 111 111 it is fine. But if you enter 11111 111111 or 11111111111 it is not. User can use either method to enter the numbers. It will all mean same. In fact most people will use the last format 11111111111. So what we need to do is somehow disable format validiation but keep the field entry validiation (numeric).
I am sorry I am taking your time but this is the first time I have come accross this kinf of validiation. Although I am in UK, I have filled in several forms belonging to USA websites and did not experience this before. It could be an important issue for people who are using form builder for their websites in the USA and hoping that someone in Europe or other counties can use the form in ease. I think the visitor will be very frustrated and give up filling the form with their details if they cannot enter the phone number or cannot get vaildiation. My telephone number will always fail validiation. If I was filling in a form which I beleive from outside UK 0044 1392 444 XXX. This would have never pass the validiation.

Do you think this should be sorted out within the program itself / or a MOD must be created to implement after? But in my opinion visitors from anywhere on the world should be able to enter their telephone number without difficulty as most forms require a validiation for this. WebAssist must agree that WWW is WORLD WIDE WEB and not just for USA.

Sign in to reply to this post

aladdin229745

Jason,
I would like to thank you for trying to sort it out for me, but thinking a bit further, I can see the above problem is not only my problem but all form builder users including the websites in the USA. Lets say you have used Webassist to build your online store and used form builder to collect customer information. If the customer cannot enter their telephone number, they will leave the site with frustration and as a result no sales. Customer may not even come back remembereing the experience he/she had.

I am already frustrated because I have spent about 4 hours trying to figure out, wasted your time trying to help me, apart from purchase of the product which doesn't do what I need it to do.

Sign in to reply to this post

Jason ByrnesWebAssist

When you set a format, the number entered must match that format.

you can force the number to be entered to match the format you wish to use by turning the character mask on:


var Appointment_request_group_Phone_Spry = new Spry.Widget.ValidationTextField("Appointment_request_group_Phone_Spry", "phone_number", { format:'phone_custom' , pattern:"00000 000 00?", useCharacterMasking:true, validateOn:["blur"]});



really, the problem you are bringing up is a limitation to the Adobe spry phone validation. if you wish to be able to allow phone numbers from any country, you would be better of using numeric validation instead of phone validation.

Sign in to reply to this post

aladdin229745

Hi Jason,
I think numeric validiation only will be ideal for me. Can you tell me how to set this up by default so anytime when I use form builder it will disregard phone formating but still use the numeric validiation.

Thanks

Sign in to reply to this post
loading

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...