API16

JModelForm/validate

The "API16" namespace is an archived namespace. This page contains information for a Joomla! version which is no longer supported. It exists only as a historical reference, it will not be improved and its content may be incomplete and/or contain broken links.

Description

Syntax

Returns

mixed Array of filtered data if valid, false otherwise.

Defined in

libraries/joomla/application/component/modelform.php

Importing

jimport('joomla.application.component.modelform');

Source Body

functionvalidate($form,$data){// Filter and validate the form data.$data=$form->filter($data);$return=$form->validate($data);// Check for an error.if(JError::isError($return)){$this->setError($return->getMessage());returnfalse;}// Check the validation results.if($return===false){// Get the validation messages from the form.foreach($form->getErrors()as$message){$this->setError($message);}returnfalse;}return$data;}

Examples

Code Examples

Content is available under Joomla! EDL unless otherwise noted.Joomla!® is a registered trademark of Open Source Matters, Inc.If you are experiencing technical issues with this website, please report it.
Notice a content problem? Create an account and fix it.