267        $this->type         = str_replace(
'Depage\\HtmlForm\\Elements\\', 
'', get_class($this));
 
  268        $this->formName     = $form->getName();
 
  270        parent::__construct(
$name, $parameters, $form);
 
  272        $this->validator    = (isset($parameters[
'validator']))
 
  274            : Validators\Validator::factory($this->type, $this->
log);
 
 
  288        parent::setDefaults();
 
  290        $this->defaults[
'autocapitalize']  = 
null;
 
  291        $this->defaults[
'autocomplete']    = 
null;
 
  292        $this->defaults[
'autocorrect']     = 
null;
 
  293        $this->defaults[
'autofocus']       = 
false;
 
  294        $this->defaults[
'errorMessage']    = _(
'Please enter valid data');
 
  296        $this->defaults[
'labelHtml']       = 
'';
 
  297        $this->defaults[
'marker']          = 
'*';
 
  298        $this->defaults[
'required']        = 
false;
 
  299        $this->defaults[
'disabled']        = 
false;
 
  300        $this->defaults[
'readonly']        = 
false;
 
  301        $this->defaults[
'title']           = 
false;
 
  302        $this->defaults[
'class']           = 
'';
 
  303        $this->defaults[
'lang']            = 
'';
 
  304        $this->defaults[
'helpMessage']     = 
'';
 
  305        $this->defaults[
'helpMessageHtml'] = 
'';
 
  306        $this->defaults[
'dataPath']        = 
null;
 
 
  319        if (!$this->validated) {
 
  320            $this->validated = 
true;
 
  323                ($this->value !== 
null)
 
 
  342        $this->validated = 
true;
 
  343        $this->valid = 
false;
 
 
  357        return $this->validator->validate($this->value);
 
 
  372            && $this->value !== 
'0' 
  373            && $this->value !== 
false 
 
  390        $this->value = $newValue;
 
  392        $this->validated = 
false;
 
 
  434        $this->errorMessage = $message;
 
 
  474        $this->defaultValue = $newDefaultValue;
 
 
  521        $this->validated = 
false;
 
 
  535        if ($this->required) {
 
  538        if ($this->disabled) {
 
  541        if ($this->readonly) {
 
  544        if (($this->value !== 
null) && (!$this->
validate())) {
 
  547        if (isset($this->skin)) {
 
  550        if (!empty($this->
class)) {
 
 
  567        return ($this->required) ? 
" <em>" . $this->
htmlEscape($this->marker) . 
"</em>" : 
"";
 
 
  579        if ($this->required)    $attributes .= 
' required="required"';
 
  580        if ($this->disabled)    $attributes .= 
' disabled="disabled"';
 
  581        if ($this->readonly)    $attributes .= 
' readonly="readonly"';
 
  582        if ($this->autofocus)   $attributes .= 
' autofocus="autofocus"';
 
  584        $autoAttributes = array(
 
  588        foreach ($autoAttributes as $attr) {
 
  589            if (!is_null($this->$attr)) {
 
  591                    $attributes .= 
" $attr=\"on\"";
 
  593                    $attributes .= 
" $attr=\"off\"";
 
  599        if (!is_null($this->autocomplete)) {
 
  600            if (is_string($this->autocomplete)) {
 
  601                $attributes .= 
" autocomplete=\"" . $this->
htmlEscape($this->autocomplete) . 
"\"";
 
  602            } 
else if ($this->autocomplete === 
true) {
 
  603                $attributes .= 
" autocomplete=\"on\"";
 
  605                $attributes .= 
" autocomplete=\"off\"";
 
 
  619        return parent::htmlDataAttributes();
 
 
  629        $attributes = 
"id=\"{$this->formName}-{$this->name}\" ";
 
  631        $attributes .= 
"class=\"" . $this->
htmlClasses() . 
"\"";
 
 
  660            && $this->value !== 
null 
  661            && $this->errorMessage !== 
"" 
 
  679        if (isset($this->helpMessage) && !empty($this->helpMessage)) {
 
  683        if (isset($this->helpMessageHtml) && !empty($this->helpMessageHtml)) {
 
  685            $helpMessage = 
"<span class=\"helpMessage\">" . $this->helpMessageHtml. 
"</span>";
 
 
 
$valid
Contains element validation status/result.
log($argument, $type=null)
error & warning logger
htmlEscape($options=array())
Escapes HTML in strings and arrays of strings.
htmlInputAttributes()
Returns string of HTML attributes for input element.
$dataPath
Extra information about the data that is saved inside the element.
$value
Input elements's value.
setRequired($required=true)
Sets the HTML required-attribute of the current input element.
$formName
Name of the parent HTML form.
getLabel()
Returns the current input elements' label.
$label
Input element - HTML label.
validate()
Validates input element.
setAutofocus($autofocus=true)
Sets the HTML autofocus-attribute of the current input element.
$autofocus
HTML autofocus attribute.
$class
class for paragraph
$errorMessage
Message that gets displayed in case of invalid input.
$helpMessageHtml
Extra help message in html format.
htmlHelpMessage()
Returns HTML-rendered helpMessage.
$required
True if the input element is required to hold a value to be valid.
__construct($name, $parameters, $form)
input class constructor
getErrorMessage()
getErrorMessage
clearValue()
resets the value to null
$classes
HTML classes attribute for rendering the input element.
$autocomplete
HTML autocomplete attribute.
typeCastValue()
converts element value
htmlDataAttributes()
Returns dataAttr escaped as attribute string.
htmlWrapperAttributes()
Returns string of HTML attributes for element wrapper paragraph.
$lang
Input element - lang.
$autocapitalize
HTML autocapitalize attribute.
htmlMarker()
Returns elements' required-indicator.
setErrorMessage($message)
setErrorMessage
setValue($newValue)
set the input element value
validatorCall()
custom validator call hook
$type
Input element type - HTML input type attribute.
$defaultValue
Input element - default value.
$readonly
wether a input element will be readonly
$validator
Holds validator object reference.
$helpMessage
Extra help message.
htmlValue()
Returns HTML-rendered element value.
$marker
Input element - HTML marker text that marks required fields.
$autocorrect
HTML autocorrect attribute.
setDefaultValue($newDefaultValue)
set the initial input element value
getValue()
Returns the current input elements' value.
htmlClasses()
Returns string of the elements' HTML-classes, separated by spaces.
setDefaults()
Sets the default values for input elements.
invalidate()
Invalidates input.
$title
Input element - HTML title.
isEmpty()
says wether the element value is empty
$labelHtml
Input element - HTML label in html format.
$pattern
HTML pattern attribute.
getDefaultValue()
gets the initial input element value
htmlErrorMessage()
Returns HTML-rendered error message.
setLabel($label)
set the label of the input
static factory($argument, $log=null)
valdiator object factory
Abstract element classes.
Validators for HTML input-elements.