Back to Form class

Method getValue

public mixed
getValue
(mixed $name, mixed $group = null, mixed $default = null)
Method to get the value of a field.
Parameters
  • string $name The name of the field for which to get the value.
  • string $group The optional dot-separated form group path on which to get the value.
  • mixed $default The optional default value of the field value is empty.
Returns
  • mixed The value of the field or the default value if empty.
Since
  • 1.7.0
Class: Form
Project: Joomla

Method getValue - Source code

/**
 * Method to get the value of a field.
 *
 * @param   string  $name     The name of the field for which to get the value.
 * @param   string  $group    The optional dot-separated form group path on which to get the value.
 * @param   mixed   $default  The optional default value of the field value is empty.
 *
 * @return  mixed  The value of the field or the default value if empty.
 *
 * @since   1.7.0
 */
public function getValue($name, $group = null, $default = null)
{
    // If a group is set use it.
    if ($group) {
        $return = $this->data->get($group . '.' . $name, $default);
    } else {
        $return = $this->data->get($name, $default);
    }
    return $return;
}