Actions

Overriding JFormRules

From Joomla! Documentation

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

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.

File:Example.jpg