Example #1
0
 /**
  * Renders a non select field.
  *
  * @return string (X)HTML.
  */
 protected function renderNonSelectField()
 {
     $o = '';
     if (function_exists('advfrm_custom_field_default')) {
         $val = advfrm_custom_field_default($this->form, $this->field->getName(), null, isset($_POST['advfrm']));
     }
     if (!isset($val)) {
         $val = isset($_POST[$this->name]) ? stsl($_POST[$this->name]) : $this->field->getDefaultValue();
     }
     if ($this->field->getType() == 'textarea') {
         $cols = $this->field->getColumnCount() ? $this->field->getColumnCount() : 40;
         $rows = $this->field->getRowCount() ? $this->field->getRowCount() : 4;
         $o .= '<textarea id="' . $this->id . '" name="' . $this->name . '" cols="' . $cols . '" rows="' . $rows . '">' . XH_hsc($val) . '</textarea>';
     } elseif ($this->field->getType() == 'output') {
         $o .= $val;
     } else {
         if ($this->field->getType() == 'date') {
             $this->initDatePicker();
         }
         $size = $this->field->getType() == 'hidden' || $this->field->getSize() ? ' size="' . $this->field->getSize() . '"' : '';
         $maxlen = in_array($this->field->getType(), array('hidden', 'file')) || !$this->field->getMaxLength() ? '' : ' maxlength="' . $this->field->getMaxLength() . '"';
         if ($this->field->getType() == 'file' && $this->field->getMaxLength()) {
             $o .= tag('input type="hidden" name="MAX_FILE_SIZE" value="' . $this->field->getMaxLength() . '"');
         }
         if ($this->field->getType() == 'file') {
             $value = '';
             $accept = ' accept="' . XH_hsc($this->prefixFileExtensionList($val)) . '"';
         } else {
             $value = ' value="' . XH_hsc($val) . '"';
             $accept = '';
         }
         $o .= tag('input type="' . $this->getInputElementType() . '" id="' . $this->id . '" name="' . $this->name . '"' . $value . $accept . $size . $maxlen);
     }
     return $o;
 }