Jump to content

Plesk Panel 9.2 does not accept dot characters in telephone numbers

Recommended Posts

Hey there,


This is a pretty straightforward one relating to the Plesk module. When signing up, customers can specify their telephone number in whatever format the order theme allows, including () around area codes and - or . delimiters such as 999.999.9999 or 999-999-9999.


This is not a problem for WHMCS, but apparently it is for Plesk (at least v9.2) which only accepts hyphens between digits when creating client accounts. When a customer recently attempted to create a new account, it resulted in the following provisioning error:


Error: 1023 - cObject::update() failed: Some fields are empty or contain an improper value. ('phone' = '902.042.2381') Errors : phone


Clearly this is not a major issue as I simply changed the format of the telephone number for the client in WHMCS and re-attempted the provisioning. However it does present a case where human interaction may be required in a supposedly entirely automated process.


It seems it would be beneficial to alter any provided telephone numbers to match a common format of XXX-XXX-XXXX while interacting with the Plesk API.





Link to comment
Share on other sites

it is a general problem that you can not force the client to fill in the phone number by a custom rule (regular expression).


Yes, I suppose that would be nice for consistency. Although not a requirement for working within WHMCS itself, it could be very handy when exporting to other applications or, in this case, while working with APIs.


I think I will see about forcing a certain scheme via Javascript during the order process. For those interested, this will be done in viewcart.tpl in the order template files.

Link to comment
Share on other sites

This may not be the greatest way of handling this problem, but it manages a few different telephone number formats and works well for most input styles.


throw this between the javascript tags at the top of your viewcart.tpl:


function toPhoneFormat(isField) {

isPhone = isField.value;

isPhone = isPhone.replace(/\D/g,''); //remove all non-decimal


//Telephone number without country code

if (isPhone.length == 10){

isPhone = isPhone.replace(/^(\d{3})(\d{3})/,'$1-$2-');

isField.value = isPhone;


//Telephone number with single digit country code

else if (isPhone.length == 11){

isPhone = isPhone.replace(/^(\d{1})(\d{3})(\d{3})/,'$1-$2-$3-');

isField.value = isPhone;


//Telephone number with double digit country code

else if (isPhone.length == 12){

isPhone = isPhone.replace(/^(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/,'$1-$2-$3-$4-$5-');

isField.value = isPhone;


//Telephone number with three digit country code

else if (isPhone.length == 13){

isPhone = isPhone.replace(/^(\d{3})(\d{3})(\d{3})/,'$1-$2-$3-');

isField.value = isPhone;


else {

isField.value = 'Invalid';





Then add this to your phone number input field:




For example:


<tr><td class="fieldarea">{$LANG.clientareaphonenumber}</td><td>{if $loggedin}{$clientsdetails.phonenumber}{else}<input type="text" name="phonenumber" size="20" value="{$clientsdetails.phonenumber}" onblur="toPhoneFormat(this)" />{/if}</td></tr>


Maybe this will help others until a single phone number format is settled by WHMCS.



Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated