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

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Another format issue

Thread began 3/28/2010 6:27 am by i.edwards384429 | Last modified 3/29/2010 3:34 am by i.edwards384429 | 1049 views | 8 replies |

i.edwards384429

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

Sign in to reply to this post

i.edwards384429

update

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

Sign in to reply to this post

neilo

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.

Sign in to reply to this post

i.edwards384429

Mmmmm

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

Sign in to reply to this post

i.edwards384429

Update

Hi

was totaly on the wrong track found the mask in the head code

thanks all

Ian

Sign in to reply to this post

neilo

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?

Sign in to reply to this post

i.edwards384429

code

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');"/>

Sign in to reply to this post

neilo

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

Sign in to reply to this post

i.edwards384429

update

Hi

Life is fun ins't it?

thanks for all the assists

Ian

Sign in to reply to this post

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...