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'
}
}
},