From d5f4e27840fa6612ad3d9d95cd472d1d42d26163 Mon Sep 17 00:00:00 2001 From: Nicolas Roman Date: Fri, 22 Mar 2019 14:56:51 +0100 Subject: [PATCH] option for hidden input in DomainInputFormField class --- evolibs/Form.php | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/evolibs/Form.php b/evolibs/Form.php index 1e23ccd..97b6921 100644 --- a/evolibs/Form.php +++ b/evolibs/Form.php @@ -463,9 +463,10 @@ class DomainInputFormField extends FormField { protected $mandatory = NULL; protected $textsize = NULL; - public function __construct($label, $mandatory=TRUE) { + public function __construct($label, $mandatory=TRUE, $hidden=FALSE) { parent::__construct($label); $this->mandatory = $mandatory; + $this->hidden = $hidden; $this->textsize = $textsize; } @@ -485,7 +486,10 @@ class DomainInputFormField extends FormField { public function getInputHTML() { $input = ''; - $input .= 'hidden) + $input .= 'name.'"'; $input .= ' name="'.$this->name.'" value="'.htmlspecialchars($this->value,ENT_QUOTES).'"'; $input .= ' maxlength="'.$this->textsize[1].'" size="'.$this->textsize[0].'" '; if($this->read_only) { $input .= 'readonly="readonly="'; } @@ -497,9 +501,13 @@ class DomainInputFormField extends FormField { public function __toString() { $out = ''; $out .= "

\n"; - $out .= $this->getLabelHTML(); - $out .= $this->getInputHTML(); - $out .= $this->getErrorHTML(); + if ($this->hidden) { + $out .= $this->getInputHTML(); + } else { + $out .= $this->getLabelHTML(); + $out .= $this->getInputHTML(); + $out .= $this->getErrorHTML(); + } $out .= "

\n\n"; return $out; }