Difference between revisions of "Overriding JFormRules"

From Joomla! Documentation

(Initial creation)
 
Line 1: Line 1:
To extend the rules that can be used by Joomla to validate form input, the following changes are needed:
+
<source lang="javascript">
 +
[[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 ==
 
== Step 1: Alter the controller ==
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.
 +
]]<ref>--~~~~Insert footnote text here</ref>
 +
</source>

Revision as of 11:55, 26 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. ]][1] </source>

  1. --~~~~Insert footnote text here