Overriding JFormRules

From Joomla! Documentation

Revision as of 17:08, 16 April 2011 by Rolandd (talk | contribs) (Initial creation)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

To extend the rules that can be used by Joomla to validate form input, the following changes are needed:

Step 1: Alter the controller

In the controller function add these lines:

$form	= $model->getForm();
$form->addRulePath(JPATH_COMPONENT.'/models/rules');

Step 2: Add the rule files

In the folder models/rules in the component add any rule file you want to use.