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

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

More than one phone number format?

Thread began 8/01/2009 2:10 am by Groshko | Last modified 8/05/2009 7:50 pm by Jason Byrnes | 6604 views | 7 replies |

Groshko

More than one phone number format?

Hello,

In the SpryValidationTextField.js file around line 425 there is the option to have a custom phone number format. No mater what I change the 'phone_custom' pattern to, my form still doesn't identify the format. Any ideas?

Many thanks,
G

'phone_number': {
formats: {
//AUST phone number; 10 digits
'phone_us': {
pattern:'(00) 0000 0000'
},
'phone_custom': {
pattern:'(00) 00000000'

}
}

Sign in to reply to this post

Jason ByrnesWebAssist

In the property inspector for the phone number spry text field, make sure that:

1) You have set the Type to Phone Number.
2) Select the Custom or US/Canada format
3) Checked the option to validate on Blur
4) Checked the required option
5) checked the Enforce Pattern Option.

Sign in to reply to this post

Groshko

Originally Said By: Jason Byrnes
  In the property inspector for the phone number spry text field, make sure that:

1) You have set the Type to Phone Number.
2) Select the Custom or US/Canada format
3) Checked the option to validate on Blur
4) Checked the required option
5) checked the Enforce Pattern Option.  




Thank-you, but still a little uncertain in some areas.
1) Are you sure the Type needs to be "Phone Number". Another example i saw the type was TEXT?

2) I don't see where the option to select "Custom/US" is. I can see this reference in the SpryValidationTextField.js, but don't know if changes are needed here?

3) Option to Validate on Blur in ok.
4) Required option is ok.
5) I don't know how to enforce this option.


Below are some code sippets i think are relvantant. Hopefully you may be able to assist me.

Many Thanks,

G


------------top of contact form--------------

$WAFV_Errors .= WAValidateRQ(((isset($_POST["Contact_Name"]))?$_POST["Contact_Name"]:"") . "",true,1);
$WAFV_Errors .= WAValidateEM(((isset($_POST["Email_address"]))?$_POST["Email_address"]:"") . "",true,2);
$WAFV_Errors .= WAValidateRQ(((isset($_POST["Comments"]))?$_POST["Comments"]:"") . "",true,3);
$WAFV_Errors .= WAValidateLE(((isset($_POST["Security_code"]))?strtolower($_POST["Security_code"]):"") . "",((isset($_SESSION["captcha_1"]))?strtolower($_SESSION["captcha_1"]):"") . "",true,4);
$WAFV_Errors .= WAValidateLE(((isset($_POST["Security_question"]))?strtolower($_POST["Security_question"]):"") . "",((isset($_SESSION["random_answer"]))?strtolower($_SESSION["random_answer"]):"") . "",true,5);
$WAFV_Errors .= WAValidateRX(((isset($_POST["addblock"]))?$_POST["addblock"]:"") . "","/^$/i",false,6);
$WAFV_Errors .= WAValidateRX(((isset($_POST["seconddblock"]))?$_POST["seconddblock"]:"") . "","/^$/i",false,7);
$WAFV_Errors .= WAValidateRQ(((isset($_POST["Phone"]))?$_POST["Phone"]:"") . "",true,8);
$WAFV_Errors .= WAValidatePN(((isset($_POST["mobile"]))?$_POST["mobile"]:"") . "",true,false,true,9);


----------middle of contact form-----------



<label for="Phone">Phone:<br>
</label>
<span id="sprytextfield5">
<input name="Phone" type="text" id="Phone" class="inputValue" onblur="if (document.getElementById('phoneServerError')) document.getElementById('phoneNameServerError').st yle.display='none'" value="<?php echo(ValidatedField("contact","Phone Number")) ?>" size="30">
<br><span class="textfieldRequiredMsg">A value is required.</span></span>

<input name="addblock" type="text" id="addblock" style="display:none" value="" />
<?php
if (ValidatedField("contact","contact")) {
if ((strpos((",".ValidatedField("contact","contact"). ","), "," . "1" . ",") !== false || "1" == "")) {
if (!(false)) {
?>
<span id="nameServerError" class="textfieldServerError">Please provide your phone.</span>
<?php //WAFV_Conditional contact.php contact(1
}
}
}?>
<br />
<span id="sprytextfield6">
<label>Mobile:<br>
<input name="Mobile" type="text" id="Mobile" size="30">
</label>
<br>
<span class="textfieldRequiredMsg">A value is required.</span></span>
<br>


--------bottom of contact form----------



<script type="text/javascript">
<!--
var sprytextfield1 = new Spry.Widget.ValidationTextField("sprytextfield1", "none", {validateOn:["blur"]});
var sprytextfield2 = new Spry.Widget.ValidationTextField("sprytextfield2", "email", {validateOn:["blur"]});
var sprytextarea1 = new Spry.Widget.ValidationTextarea("sprytextarea1", {validateOn:["blur"]});
var sprytextfield3 = new Spry.Widget.ValidationTextField("sprytextfield3", "none", {validateOn:["blur"], minChars:<?php echo $WAGLOBAL_Captcha_Characters; ?>, maxChars:<?php echo $WAGLOBAL_Captcha_Characters; ?>});
var sprytextfield4 = new Spry.Widget.ValidationTextField("sprytextfield4", "none", {validateOn:["blur"]});
var sprytextfield5 = new Spry.Widget.ValidationTextField("sprytextfield5", "phone_number", {validateOn:["blur"]});
var sprytextfield6 = new Spry.Widget.ValidationTextField("sprytextfield6", "mobile_number", {validateOn:["blur"]});
//-->
</script>




---------phone refference on SpryValidationTextField.js--------

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

}
}
},

'mobile_number': {
formats: {
//US phone number; 10 digits
'phone_us': {
pattern:'0000 000 000'
},
'phone_custom': {
pattern:'0000 000 0000'

}
}
},

Sign in to reply to this post

Jason ByrnesWebAssist

try changing:
var sprytextfield5 = new Spry.Widget.ValidationTextField("sprytextfield5", "phone_number", {validateOn:["blur"]});
var sprytextfield6 = new Spry.Widget.ValidationTextField("sprytextfield6", "mobile_number", {validateOn:["blur"]});


to:
var sprytextfield5 = new Spry.Widget.ValidationTextField("sprytextfield5", "phone_number", {validateOn:["blur"], useCharacterMasking:true});
var sprytextfield6 = new Spry.Widget.ValidationTextField("sprytextfield6", "phone_number", {validateOn:["blur"], useCharacterMasking:true});

Sign in to reply to this post

Groshko

Originally Said By: Jason Byrnes
  try changing:
var sprytextfield5 = new Spry.Widget.ValidationTextField("sprytextfield5", "phone_number", {validateOn:["blur"]});
var sprytextfield6 = new Spry.Widget.ValidationTextField("sprytextfield6", "mobile_number", {validateOn:["blur"]});


to:
var sprytextfield5 = new Spry.Widget.ValidationTextField("sprytextfield5", "phone_number", {validateOn:["blur"], useCharacterMasking:true});
var sprytextfield6 = new Spry.Widget.ValidationTextField("sprytextfield6", "phone_number", {validateOn:["blur"], useCharacterMasking:true});  





Thank-you. This is coming along nicely.
Hopefully this is my last question.

I have two phone fields, phone and mobile phone.
Both of these fields are required by the user, but I would like the mobile phone not to be a requirement. This field stills need to be a spry, for if somebody does fill this out it follows the mask that is in place. Does anybody know how to set this to "not required"?

Many Thanks Team!

Sign in to reply to this post

Jason ByrnesWebAssist

To change the behavior of a spry text field, select the text box in design view. When the text box is selected, you will notice a blue bounding box appear with the wordds "Spry Text Field: sprytextfield<id>" Click this. In the property inspector, you will be ablwe to modify the spry text field behaviors. Uncheck the required option for the mobile phone text field so it will not be required any more.

Sign in to reply to this post

Groshko

GREAT!!!
Thank-you for your help. I had no idea how to find the property inspector. All makes sense now.

Thanks,

G

Sign in to reply to this post

Jason ByrnesWebAssist

Glad to hear it is sorted for you now.

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