Validation Conditional on Other Element

griffin

Member
Hi All - happy new year from New Zealand.

I have a form with 3 phone number elements (work, home, mobile) and need a validation that at least one is notempty. I'm unsure of whether this can be done through element validation or not.

Anyone able to provide assistance on how I can achieve this?
 
You can add a php validation where you can do (nearly) every thing you want to.
In your case something like
Code:
$app = JFactory::getApplication();
$w = $app->input->get('your-tablename___work', '', 'string');
$h = $app->input->get('your-tablename___home', '', 'string');
$m = $app->input->get('your-tablename___mobile', '', 'string');
$cond= ($w<>'') || ($h<>''|| ($m<>'');
return $cond;
on every element
http://fabrikar.com/forums/index.php?wiki/php-validation/

An other possibility is to add a php form plugin which is doing the same check and then stopping form submission.
http://fabrikar.com/forums/index.php?wiki/php-form-plugin/#stopping-form-submission
 
We are in need of some funding.
More details.

Thank you.

Members online

No members online now.
Back
Top