RSForm minimum character for phone | phone validation Joomla

How to use a minimum character count for RSForms - making use of the validation extra.
This is especially useful to make sure that customers do not enter unsufficient digits for you to be able to contact them!
1. Open: /components/com_rsform/controller/functions.php
2. Add the following code:
function phone($phone) {
$phone_2 = preg_replace('/[^0-9]+/', '', $phone );
if($phone_2=='') return true;
$len = strlen($phone_2);
if($len == 11 || $len == 14) {
return true;
} else {
return false;
}
}
The above code will require a minimum character count of 11 up to 14, easily changed.
3. Upload your new file, making sure to backup your original version.
You may need to CHOWN your ‘controller’ directory to your FTP user before upload will be allowed.
4. Next, login into your Joomla backend and locate your form manager and for phone ‘Validation Rule’ choose your newly created ‘Phone’ rule from the dropdown.
Working Example
You can check this working on the following URL: www.24-is.co.uk Noting the “Request a Call Back” block near the footer (this is a live site so please only use digits less than 11 to test, thanks).
RSForm minimum character for phone | phone validation Joomla
Related Articles
- 17.09.12: Import Export sql database the easy way via SSH (0)
- 21.06.12: An A-Z Index of the Bash command line for Linux. (0)
- 06.06.12: multiple ip and smtp_banners (0)









Comments RSS Feed



great tutorial !! Thanks for awesome tut..
Go to Top of the page
Thank you so much. I was looking for this for a website project.
Go to Top of the page