示例#1
0
 /**
  * (non-PHPdoc)
  * @see \vxPHP\Form\FormElement\InputElement::setType()
  * 
  * @return vxPHP\Form\FormElement\ButtonElement
  */
 public function setType($type)
 {
     $type = strtolower($type);
     if (in_array($type, array('button', 'submit', 'reset'))) {
         parent::setType($type);
     }
     return $this;
 }
示例#2
0
 /**
  * (non-PHPdoc)
  * @see \vxPHP\Form\FormElement\InputElement::render()
  */
 public function render($force = FALSE)
 {
     if (empty($this->html) || $force) {
         $this->attributes['type'] = 'submit';
         $this->html = parent::render(TRUE);
     }
     return $this->html;
 }
示例#3
0
 /**
  * (non-PHPdoc)
  * @see \vxPHP\Form\FormElement\InputElement::render()
  */
 public function render($force = FALSE)
 {
     if (empty($this->html) || $force) {
         if ($this->checked) {
             $this->attributes['checked'] = 'checked';
         } else {
             unset($this->attributes['checked']);
         }
         $this->attributes['type'] = 'checkbox';
         $this->html = parent::render(TRUE) . ($this->label ? sprintf('<label>%s</label>', $this->label) : '');
     }
     return $this->html;
 }
示例#4
0
 /**
  * render spam countermeasures
  */
 private function renderAntiSpam()
 {
     $secret = md5(uniqid(NULL, TRUE));
     $label = md5($secret);
     Session::getSessionDataBag()->set('antiSpamTimer', [$secret => microtime(TRUE)]);
     $e = new InputElement('verify', NULL);
     $e->setAttribute('type', 'hidden');
     $this->addElement($e);
     $e->setValue($secret);
     return sprintf("\n\t\t\t<div>%s\n\t\t\t\t<span style='display:none;'>\n\t\t\t\t\t<label for='confirm_entry_%s'>Leave this field empty!</label>\n\t\t\t\t\t<input id='confirm_entry_%s' name='confirm_entry_%s' value=''>\n\t\t\t\t</span>\n\t\t\t</div>", $e->render(), $label, $label, $label);
 }
示例#5
0
 /**
  * (non-PHPdoc)
  * @see \vxPHP\Form\FormElement\InputElement::render()
  */
 public function render($force = FALSE)
 {
     $this->attributes['type'] = 'image';
     return parent::render($force);
 }