I use ChronoEngine (ChronoForms) in Joomla. It uses
LiveValidation for the fields.
Haven't used the php validation. LiveValidation is cool as it can validate as you type (prior to/prevent submit) and also with a delay, wait x-amount of time after you stop typing in the field - to validate/display msg.
This was a custom code for a phone-number field.
Code:
window.addEvent('load', function() {
var phone_val = new LiveValidation('text_12', { wait: 1000 });
phone_val.add(
Validate.Format, {
pattern: /^(?:(?:\+?1\s*(?:[.-]\s*)?)?(?:(\s*([2-9]1[02-9]|[2-9][02-8]1|[2-9][02-8][02-9])\s*)|([2-9]1[02-9]|[2-9][02-8]1|[2-9][02-8][02-9]))\s*(?:[.-]\s*)?)?([2-9]1[02-9]|[2-9][02-9]1|[2-9][02-9]{2})\s*(?:[.-]\s*)?([0-9]{4})$/i,
failureMessage: 'Not a valid phone number.' });
var fax_val = new LiveValidation('text_13', { wait: 1000 });
fax_val.add(
Validate.Format, {
pattern: /^(?:(?:\+?1\s*(?:[.-]\s*)?)?(?:(\s*([2-9]1[02-9]|[2-9][02-8]1|[2-9][02-8][02-9])\s*)|([2-9]1[02-9]|[2-9][02-8]1|[2-9][02-8][02-9]))\s*(?:[.-]\s*)?)?([2-9]1[02-9]|[2-9][02-9]1|[2-9][02-9]{2})\s*(?:[.-]\s*)?([0-9]{4})$/i,
failureMessage: 'Not a valid phone number.' });
});