API16

JFormRuleRules/test

From Joomla! Documentation

< API16:JFormRuleRules
Revision as of 17:34, 22 March 2010 by Doxiki (talk | contribs) (New page: ===Description=== Method to test if two values are equal. To use this rule, the form XML needs a validate attribute of equals and a field attribute that is equal to the field to test agai...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

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[edit]

Method to test if two values are equal. To use this rule, the form XML needs a validate attribute of equals and a field attribute that is equal to the field to test against.

[Edit Descripton]

Template:Description:JFormRuleRules/test

Syntax[edit]

test(&$field, &$values)
Parameter Name Default Value Description
$field A reference to the form field.
$values The values to test for validiaty.

Returns[edit]

mixed on invalid rule, true if the value is valid, false otherwise.

Defined in[edit]

libraries/joomla/form/rules/rules.php

Importing[edit]

jimport( 'joomla.form.rules.rules' );

Source Body[edit]

public function test(&$field, &$values)
{
        $name = (string)$field->attributes()->name;

        // TODO: probably should check to see if the action is even available for this field.
//              $values[$name];

        return true;
}

[Edit See Also] Template:SeeAlso:JFormRuleRules/test

Examples[edit]

<CodeExamplesForm />