Ejemplo n.º 1
0
 /**
  * Adds a single checkbox.
  *
  * @param string $name       The name of the element.
  * @param bool   $checked    Should the checkbox be checked?
  * @param string $class      Class(es) that will be applied on the element.
  * @param string $classError Class(es) that will be applied on the element when an error occurs.
  * @return \SpoonFormCheckbox
  */
 public function addCheckbox($name, $checked = false, $class = null, $classError = null)
 {
     $name = (string) $name;
     $checked = (bool) $checked;
     $class = $class !== null ? (string) $class : 'inputCheckbox';
     $classError = $classError !== null ? (string) $classError : 'inputCheckboxError';
     // create and return a checkbox
     return parent::addCheckbox($name, $checked, $class, $classError);
 }
Ejemplo n.º 2
0
 public function testMain()
 {
     $frm = new SpoonForm('name', 'action');
     $frm->addButton('submit', 'submit');
     $frm->addCheckbox('agree', true);
     $frm->addDate('date', time(), 'd/m/Y');
     $frm->addDropdown('author', array(1 => 'Davy', 'Tijs', 'Dave'), 1);
     $frm->addFile('pdf');
     $frm->addImage('image');
     $frm->addHidden('cant_see_me', 'whoop-tie-doo');
     $frm->addMultiCheckbox('hobbies', array(array('label' => 'Swimming', 'value' => 'swimming')));
     $frm->addPassword('top_sekret', 'stars-and-stripes');
     $frm->addRadiobutton('gender', array(array('label' => 'Male', 'value' => 'male')));
     $frm->addTextarea('message', 'big piece of text');
     $frm->addText('email', '*****@*****.**');
     $frm->addText('now', date('H:i'));
 }