Difference between revisions of "Overriding JFormRules"
From Joomla! Documentation
m (added Category:Development using HotCat) |
|||
(One intermediate revision by one other user not shown) | |||
Line 14: | Line 14: | ||
In the folder models/rules in the component add any rule file you want to use. | In the folder models/rules in the component add any rule file you want to use. | ||
− | |||
</source> | </source> | ||
+ | [[File:Example.jpg]]== Step 2: Add the rule files == | ||
+ | |||
+ | In the folder models/rules in the component add any rule file you want to use. | ||
+ | </source> | ||
+ | <gallery> | ||
+ | File:Example.jpg|Caption1 | ||
+ | File:Example.jpg|Caption2 | ||
+ | </gallery> | ||
+ | |||
+ | [[Category:Development]] |
Revision as of 00:21, 27 June 2013
[[File: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:
<source lang="php">
$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. </source> == Step 2: Add the rule files ==
In the folder models/rules in the component add any rule file you want to use. </source>