$form
$form : \Horde_Form
The form instance this variable is assigned to.
This class represents a single form variable that may be rendered as one or more form fields.
$form : \Horde_Form
The form instance this variable is assigned to.
$type : \Horde_Form_Type
A {@link Horde_Form_Type} instance.
$_action : \Horde_Form_Action
A {@link Horde_Form_Action} instance.
$_hidden : boolean
Whether this is a hidden variable.
Horde_Form_Variable(string $humanName, string $varName, \Horde_Form_Type $type, boolean $required, boolean $readonly = false, string $description = null)
Variable constructor.
string | $humanName | A short description of the variable's purpose. |
string | $varName | The internally used name. |
\Horde_Form_Type | $type | A {@link Horde_Form_Type} instance. |
boolean | $required | Whether this is a required variable. |
boolean | $readonly | Whether this is a readonly variable. |
string | $description | A long description of the variable's purpose, special instructions, etc. |
setFormOb(\Horde_Form $form)
Assign this variable to the specified form.
\Horde_Form | $form | The form instance to assign this variable to. |
setAction(\Horde_Form_Action $action)
Assigns an action to this variable.
Example:
$v = $form->addVariable('My Variable', 'var1', 'text', false);
$v->setAction(Horde_Form_Action::factory('submit'));
\Horde_Form_Action | $action | A {@link Horde_Form_Action} instance. |
getType() : \Horde_Form_Type
Returns this variable's type.
This variable's {@link Horde_Form_Type} instance.
getInfo(\Variables $vars, mixed $info) : mixed
Processes the submitted value of this variable according to the rules of the variable type.
\Variables | $vars | The {@link Variables} instance of the submitted form. |
mixed | $info | A variable passed by reference that will be assigned the processed value of the submitted variable value. |
Depending on the variable type.
wasChanged(\Variables $vars) : boolean
Returns whether this variable if it had the "trackchange" option set has actually been changed.
\Variables | $vars | The {@link Variables} instance of the submitted form. |
Null if this variable doesn't have the "trackchange" option set or the form wasn't submitted yet. A boolean indicating whether the variable was changed otherwise.
validate(\Variables $vars, string $message) : boolean
Validates this variable.
\Variables | $vars | The {@link Variables} instance of the submitted form. |
string | $message | A variable passed by reference that will be assigned a descriptive error message if validation failed. |
True if the variable validated.
getValue(\Variables $vars, integer $index = null) : mixed
Returns the submitted or default value of this variable.
If an action is attached to this variable, the value will get passed to the action object.
\Variables | $vars | The {@link Variables} instance of the submitted form. |
integer | $index | If the variable is an array variable, this specifies the array element to return. |
The variable or element value.