Difference between revisions of "Overriding JFormRules"

From Joomla! Documentation

(Initial creation)
 
(Cleanup source a bit and add Needs review)
 
(3 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 +
{{review||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:
 
To extend the rules that can be used by Joomla to validate form input, the following changes are needed:
  
Line 13: 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.
 +
 +
[[File:Example.jpg]]
 +
 +
<gallery>
 +
File:Example.jpg|Caption1
 +
File:Example.jpg|Caption2
 +
</gallery>
 +
 +
[[Category:Development]]

Latest revision as of 21:16, 14 June 2014

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