Overriding JFormRules

From Joomla! Documentation

Revision as of 02:16, 15 June 2014 by Wilsonge (talk | contribs) (Cleanup source a bit and add Needs review)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Copyedit.png
This Article Needs Your Help

This article is tagged because it NEEDS REVIEW. You can help the Joomla! Documentation Wiki by contributing to it.
More pages that need help similar to this one are here. NOTE-If you feel the need is satistified, please remove this notice.

Reason: Article needs structure and examples to be improved


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

Step 1: Alter the controller[edit]

In the controller function add these lines:

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

Step 2: Add the rule files[edit]

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

Documentation all together tranparent small.png