JFORMRULE-STAR-001
JFormRuleEmail / JFormRuleUrl / JFormRuleEquals / …
JFormRule* validators
Form validation rule class names followed JFormRuleX. Native Joomla 6 uses namespaced Rule classes. Custom rules that extend the J3 name fail when the alias plugin is off.
JFormRuleEmail / JFormRuleUrl / JFormRuleEquals / … → Joomla\CMS\Form\Rule\*Rule
What you will see
- Class "JFormRuleEmail" not found
- Class "JFormRuleUrl" not found
- Class "JFormRuleEquals" not found
Symptoms people search
form validation class not found · JFormRule
Replace this code
Swap JFormRuleEmail / JFormRuleUrl / JFormRuleEquals / … for Joomla\CMS\Form\Rule\*Rule.
Joomla 3
Remove or stop calling this
class JFormRuleLmsSku extends JFormRule {}Joomla 4 / 6
Use this instead
use Joomla\CMS\Form\FormRule;
class LmsSkuRule extends FormRule {
public function test(\SimpleXMLElement $element, $value, $group = null, ?\Joomla\Registry\Registry $input = null, ?\Joomla\CMS\Form\Form $form = null): bool { return true; }
}How to fix it
- 1Extend FormRule or the specific *Rule.
- 2Point the XML validate="lmssku" at the namespaced class.
Also known as
JFormRuleBoolean · JFormRuleCalendar · JFormRuleColor · JFormRuleEmail · JFormRuleEquals · JFormRuleNotequals · JFormRuleNumber · JFormRuleOptions · JFormRuleRules · JFormRuleTel · JFormRuleUrl · JFormRuleUsername · EmailRule · UrlRule · EqualsRule
Related issues
- Joomla 3 → 4Joomla API
JRequest::getVar() and the whole JRequest API
JRequest::getVar() → $app->getInput()->get('id')
- Joomla 3 → 4Joomla API
JError / JException
JError::raiseError() → throw new RuntimeException() / try-catch
- Joomla 3 → 4Joomla API
isAdmin() / isSite()
$app->isAdmin() → $app->isClient('administrator') / isClient('site')
- Joomla 3 → 4Joomla API
Factory::getUri()
JFactory::getUri() → Uri::getInstance()
- Joomla 3 → 4Joomla API
Factory::getXml() / JXMLElement
JFactory::getXML() → SimpleXMLElement
- Joomla 3 → 4Joomla API
Factory::getEditor()
JFactory::getEditor() → Editor::getInstance()