option for hidden input in DomainInputFormField class
This commit is contained in:
parent
f90b127a95
commit
d5f4e27840
|
@ -463,9 +463,10 @@ class DomainInputFormField extends FormField {
|
||||||
protected $mandatory = NULL;
|
protected $mandatory = NULL;
|
||||||
protected $textsize = NULL;
|
protected $textsize = NULL;
|
||||||
|
|
||||||
public function __construct($label, $mandatory=TRUE) {
|
public function __construct($label, $mandatory=TRUE, $hidden=FALSE) {
|
||||||
parent::__construct($label);
|
parent::__construct($label);
|
||||||
$this->mandatory = $mandatory;
|
$this->mandatory = $mandatory;
|
||||||
|
$this->hidden = $hidden;
|
||||||
$this->textsize = $textsize;
|
$this->textsize = $textsize;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -485,7 +486,10 @@ class DomainInputFormField extends FormField {
|
||||||
|
|
||||||
public function getInputHTML() {
|
public function getInputHTML() {
|
||||||
$input = '';
|
$input = '';
|
||||||
$input .= '<input type="text" id="'.$this->name.'"';
|
if ($this->hidden)
|
||||||
|
$input .= '<input type="hidden" id="'.$this->name.'"';
|
||||||
|
else
|
||||||
|
$input .= '<input type="text" id="'.$this->name.'"';
|
||||||
$input .= ' name="'.$this->name.'" value="'.htmlspecialchars($this->value,ENT_QUOTES).'"';
|
$input .= ' name="'.$this->name.'" value="'.htmlspecialchars($this->value,ENT_QUOTES).'"';
|
||||||
$input .= ' maxlength="'.$this->textsize[1].'" size="'.$this->textsize[0].'" ';
|
$input .= ' maxlength="'.$this->textsize[1].'" size="'.$this->textsize[0].'" ';
|
||||||
if($this->read_only) { $input .= 'readonly="readonly="'; }
|
if($this->read_only) { $input .= 'readonly="readonly="'; }
|
||||||
|
@ -497,9 +501,13 @@ class DomainInputFormField extends FormField {
|
||||||
public function __toString() {
|
public function __toString() {
|
||||||
$out = '';
|
$out = '';
|
||||||
$out .= "<p>\n";
|
$out .= "<p>\n";
|
||||||
$out .= $this->getLabelHTML();
|
if ($this->hidden) {
|
||||||
$out .= $this->getInputHTML();
|
$out .= $this->getInputHTML();
|
||||||
$out .= $this->getErrorHTML();
|
} else {
|
||||||
|
$out .= $this->getLabelHTML();
|
||||||
|
$out .= $this->getInputHTML();
|
||||||
|
$out .= $this->getErrorHTML();
|
||||||
|
}
|
||||||
$out .= "</p>\n\n";
|
$out .= "</p>\n\n";
|
||||||
return $out;
|
return $out;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue