PDA

View Full Version : uk format phone number


i.edwards384429
08-19-2010, 01:59 AM
Hi

I thought this was the correct format to set the phone number format but it fails


<tr>
<th>Phone Number:</th>
<td><span id="sprytextfield4">
<input name="UserPhone" type="text" class="WAATKTextField" id="UserPhone" onBlur="if (document.getElementById('PhoneServerValidation')) document.getElementById('PhoneServerValidation').s tyle.display='none';WAValidatePN(document.getEleme ntById('WAATKRegistrationForm').UserEmail,'- Invalid phone number',false,true,'(xxxxx) xxxxxx',document.getElementById('WAATKRegistration Form').UserEmail,0,true)" value="<?php echo(ValidatedField("usersRegistration","UserPhone")) ?>" size="32" />
<span class="textfieldRequiredMsg">A value is required.</span><span class="textfieldMinCharsMsg">Minimum number of characters not met.</span><span class="textfieldMaxCharsMsg">Exceeded maximum number of characters.</span></span>
<?php
if (ValidatedField("usersRegistration","usersRegistration")) {
if ((strpos((",".ValidatedField("usersRegistration","usersRegistration").","), "," . "13" . ",") !== false || "13" == "")) {
if (!(false)) {
?>
<span class="textfieldServerError" id="PhoneServerValidation">
Please enter your phone number. </span>
<?php //WAFV_Conditional users_Registration.php usersRegistration(13:)
}
}
}?></td>
</tr>



var sprytextfield4 = new Spry.Widget.ValidationTextField("sprytextfield4", "phone_number", {format:"phone_custom", useCharacterMasking:true, pattern:"(00000) 000000", isRequired:false});

what have I missed?

thanks

Ian

Jason Byrnes
08-19-2010, 06:48 AM
change:
<input name="UserPhone" type="text" class="WAATKTextField" id="UserPhone" onBlur="if (document.getElementById('PhoneServerValidation')) document.getElementById('PhoneServerValidation').s tyle.display='none';WAValidatePN(document.getEleme ntById('WAATKRegistrationForm').UserEmail,'- Invalid phone number',false,true,'(xxxxx) xxxxxx',document.getElementById('WAATKRegistration Form').UserEmail,0,true)" value="<?php echo(ValidatedField("usersRegistration","UserPhone ")) ?>" size="32" />


to:
<input name="UserPhone" type="text" class="WAATKTextField" id="UserPhone" onBlur="if (document.getElementById('PhoneServerValidation')) document.getElementById('PhoneServerValidation').s tyle.display='none';WAValidatePN(document.getEleme ntById('WAATKRegistrationForm').UserEmail,'- Invalid phone number',false,true,'',document.getElementById('WAA TKRegistration Form').UserEmail,0,true)" value="<?php echo(ValidatedField("usersRegistration","UserPhone ")) ?>" size="32" />

i.edwards384429
08-19-2010, 01:22 PM
Hi Jason

I've clearly missed something out here because my attempts at Uk postcode and phone number both failed. I've had it workinmg before but now it's failed. Added your code and still no go.

I've attached the page in question if you get time can you take a look and tell me where I've gone wrong

thanks

Ian

Jason Byrnes
08-19-2010, 01:37 PM
for some reason, the phone number field is set to validate the useremail field as a phone number.


change:
<input name="UserPhone" type="text" class="WAATKTextField" id="UserPhone" onBlur="if (document.getElementById('PhoneServerValidation')) document.getElementById('PhoneServerValidation').s tyle.display='none';WAValidatePN(document.getEleme ntById('WAATKRegistrationForm').UserEmail,'- Invalid phone number',false,true,'',document.getElementById('WAA TKRegistration Form').UserEmail,0,true)" value="<?php echo(ValidatedField("usersRegistration","UserPhone ")) ?>" size="32" />


to:
<input name="UserPhone" type="text" class="WAATKTextField" id="UserPhone" onBlur="if (document.getElementById('PhoneServerValidation')) document.getElementById('PhoneServerValidation').s tyle.display='none';WAValidatePN(document.getEleme ntById('WAATKRegistrationForm').UserPhone,'- Invalid phone number',false,true,'',document.getElementById('WAA TKRegistration Form').UserPhone,0,true)" value="<?php echo(ValidatedField("usersRegistration","UserPhone ")) ?>" size="32" />