if ($type === null) $type = $this->html_type();
foreach ($values as $value) {
- $html .= '<div class="label '.$this->name.'"><label for="'.$this->name.'">'.htmlspecialchars(prettyText($this->name)).'</label>';
+ $html .= '<div class="label '.$this->name.'">'
+ .'<label for="'.$this->name.'">'.htmlspecialchars(prettyText($this->name)).'</label>'
+ ;
if ($this->extras) {
$html .= '<span class="extra '.$this->name.'">'.$this->out($value).'</span>';
$html .= $this->htmlYesNo($value);
} else {
+ # NB 09.02.18: needed ?
if ($tag == 'textarea' and $type != 'text') $tag = 'input';
if ($media = Mime::html($value,'')) {
$tag = 'input';
$html .= $media;
}
- # NB 09.02.18: needed ?
- #$tag = 'textarea';
$html .= '<'.$tag
.' name="'.$this->preffix.$this->name.$suff.'"'
- # NB 06.02.18 .' id="'.$this->name.'"'
.( ($size and $tag != 'textarea') ? ' size="'.$size.'"' : '')
- #.' value="'.$value.'"'
.($tag == 'textarea' ? '>'.$value.'</textarea>' : ' type="'.$type.'" value="'.htmlspecialchars($value).'" />')
;
}
+ # If more than one value, add js code to add more values
+ if ($suff) $html .= '<a href="#" onclick="var i=this.parentNode;var j=i.cloneNode(true);j.querySelectorAll(\'input, textarea, select\').forEach(function(e) {e.value=\'\';}); i.parentNode.insertBefore(j, i.nextSibling);console.log(i.className); return false;">+</a>';
+
$html .= '</div>'.NB_EOL;
}