Exemple #1
0
 function generateHTML()
 {
     $value = $this->getEffectiveValue();
     $options = '';
     foreach ($this->options as $i => $option) {
         if (!isset($option['value'])) {
             $optgroup = '';
             foreach ($option as $suboption) {
                 $attributes = array('value' => $suboption['value']);
                 if ($suboption['value'] == $value) {
                     $attributes['selected'] = 'selected';
                 }
                 $optgroup .= DingesForm::generateTag('option', $attributes, $suboption['content']);
             }
             $options .= DingesForm::generateTag('optgroup', array('label' => $i), $optgroup);
             continue;
         }
         $attributes = array('value' => $option['value']);
         if (is_array($value)) {
             if (in_array($option['value'], $value)) {
                 $attributes['selected'] = 'selected';
             }
         } else {
             if ($option['value'] == $value) {
                 $attributes['selected'] = 'selected';
             }
         }
         $options .= DingesForm::generateTag('option', $attributes, $option['content']);
     }
     return DingesForm::generateTag($this->element, $this->attributes, $options) . $this->getRestrictionComment();
 }
Exemple #2
0
 function generateHTML()
 {
     if (!($content = $this->getEffectiveValue())) {
         $content = '';
     }
     return DingesForm::generateTag($this->element, $this->attributes, htmlspecialchars($content, ENT_NOQUOTES)) . $this->getRestrictionComment();
 }
Exemple #3
0
 function generateItemHTML($item, $checked)
 {
     $attributes = $this->attributes;
     $attributes['id'] = $this->getFullId() . '_' . $item['value'];
     $attributes['value'] = $item['value'];
     if ($checked) {
         $attributes['checked'] = 'checked';
     }
     return DingesForm::generateTag('input', $attributes);
 }
Exemple #4
0
 function getLabelTag()
 {
     if ($this->realLabelTag) {
         $element = 'label';
         $this->setLabelAttribute('for', $this->getFullId());
     } else {
         $element = 'span';
     }
     return DingesForm::generateTag($element, $this->labelAttributes, $this->label);
 }
Exemple #5
0
 function generateErrorElement()
 {
     $attributes = array();
     $attributes['id'] = $this->getFullId() . '_error';
     $attributes['class'] = 'dingesErrorSpan';
     if ($this->isValid() || !$this->form->isPosted()) {
         $content = '';
     } else {
         $content = $this->form->getErrorMessage($this->errorCode);
     }
     if ($content && $this->form->getErrorIcon()) {
         $imgattributes = array();
         $imgattributes['src'] = $this->form->getErrorIcon();
         $imgattributes['alt'] = $content;
         $imgattributes['onClick'] = "alert('" . str_replace("'", ''', $content) . "');";
         $content = DingesForm::generateTag('img', $imgattributes);
     }
     return DingesForm::generateTag('span', $attributes, $content);
 }
Exemple #6
0
 function generateHTML()
 {
     $out = parent::generateHTML();
     if ($this->maxFileSize !== NULL) {
         return DingesForm::generateTag('input', array('type' => 'hidden', 'name' => 'MAX_FILE_SIZE', 'value' => $this->maxFileSize)) . $out;
     }
     return $out;
 }
Exemple #7
0
 function generateHTML()
 {
     return DingesForm::generateTag('span', array('id' => $this->getFullId()), $this->getDefaultValue());
 }
Exemple #8
0
require 'multiinputfield.php';
require 'text.php';
require 'checkbox.php';
require 'submit.php';
require 'select.php';
require 'textarea.php';
require 'integer.php';
require 'password.php';
require 'radiobutton.php';
require 'static.php';
require 'checklist.php';
require 'multiplesubmit.php';
require 'hidden.php';
require 'submitimage.php';
require 'file.php';
$f = new DingesForm();
$f->setAutoFocus(true);
$f->setFieldIdPrefix('blaat_');
//$f->setErrorIcon('exclamation.png');
$f->setErrorMessage('ERR_UNSAFE', 'Het wachtwoord mag niet gelijk zijn aan de gebruikersnaam');
$name = $f->createInputField('text', 'name', true, 'Naam');
$name->setMaxLength(20);
$name->setMinLength(5);
$name->addValidationRegex('/^\\S+$/');
$bla = $f->createInputField('checkbox', 'bla', false, 'Bla');
$bla->setDefaultValue(true);
$boink = $f->createInputField('select', 'boink', false, 'Boïnk');
$boink->addItem('"bla"', '"bla"');
$boink->addItem('schaap', 'schaëp');
$boink->addItem('50', '€ 50,-');
$piet = $f->createInputField('textarea', 'piet', false, 'Piet"je"');