Another format issue
Hi
where is the phone number format picked up from? I selected custom and in the box put:
(00000) 000000 - which is the UK format but it still reverts to US phone number format
thanks
Ian
Hi
where is the phone number format picked up from? I selected custom and in the box put:
(00000) 000000 - which is the UK format but it still reverts to US phone number format
thanks
Ian
After searching I found this code in spryvalidationtextfield.js and modified it as follows
'phone_number': {
formats: {
//US phone number; 10 digits
'phone_us': {
pattern:'(000) 000-0000'
},
'phone_custom': {pattern:'(00000) 0000000'}
}
To my total lack of surprise it did not change the format to UK
Ian
For the Spry validation, if you wanted the phone field to be entered in that exact format, you would select 'custom' from the Spry options in the properties panel, and in the 'Pattern' field you would put: (00000) 000000
You would also show this pattern in the 'Hint' field by typing in something like (01234) 123456 because I think few people would think to do it in that format.
Other custom options for UK format to put in the Pattern and Hint boxes could be 00000 000000 or 00000-000000
If you are also using WA Server Validation to validate this field, select Validation type Phone Number, and tick the box 'Allow international' - this allows for all phone number variations.
I tend to make the Spry just validate as 'Required' (with 'None' selected as Type) and then use the WA Server vlidation as Phone Number with 'Allow International'. This seems to cover all situations.
Hi
thanks for that, although I think I've confused myself. - ok not difficult
As it stands if I type in 123456789 when the field looses focus it automatically reformats to the US phone format. What I want is it to automatically reformat to the UK format, I dont want the user to have to type in (12345) 123456
So I suspect I'm on totaly the wrong track. In a database program I'd be looking for mask but here I'm a bit confused. I thought that the formbuilder used client side validation so the "mask" would be in the JS file
cheers
Ian
Hi
was totaly on the wrong track found the mask in the head code
thanks all
Ian
Hi Ian,
FormBuilder uses both server side and client side validation, so the Spry (client side) character masking (which is enabled by making sure that the 'Enforce Pattern' check box has been ticked in the spry panel) writes the option to the javascript textfield widget for the phone textfield at the bottom of the page.
So now I'm confused, what got written to the head code in your page, and how did you do it?
Hi
Ok I admit I'm on the learning curve but the code I found in the head is below with the "mask" altered to a UK format ie (xxxxx) xxxxxx
It works for me
cheer
Ian
<span id="Appointment_request_group_Phone_Spry">
<input id="Appointment_request_group_Phone" name="Appointment_request_group_Phone" type="text" value="<?php echo((isset($_GET["invalid"])?ValidatedField("appointments","Appointment_request_group_Phone"):"")); ?>" class="formTextfield_Large" tabindex="5" onblur="WAValidatePN(document.getElementById('AppointmentRequest_ashbury_ashbury1').Appointment_request_group_Phone,'',false,true,'(xxxxx) xxxxxx',document.getElementById('AppointmentRequest_ashbury_ashbury1').Appointment_request_group_Phone,0,true);hideServerError('Appointment_request_group_Phone_ServerError');"/>
Cool, Nice one. Glad you got it working the way you want it.
Mine is practically identical to yours, but the input code is in the form in the body area of the page.
You should also have the widget script line near the bottom of your page looking a bit like:
var Appointment_request_group_Phone = new Spry.Widget.ValidationTextField("Appointment_request_group_Phone", "phone_number", {format:"phone_custom", validateOn:["blur"], pattern:"00000-000000", useCharacterMasking:true});
Everything about this is a never-ending learning curve for me, - just when I think I'm getting somewhere, everything goes pear-shaped.
Cheers
Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.
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.