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'));
 }
Exemple #2
0
 /**
  * Adds a single radiobutton.
  *
  * @param string $name The name of the element.
  * @param array $values The possible values for the radiobutton.
  * @param string[optional] $checked Should the element be checked?
  * @param string[optional] $class Class(es) that will be applied on the element.
  * @param string[optional] $classError Class(es) that will be applied on the element when an error occurs.
  * @return SpoonFormRadiobutton
  */
 public function addRadiobutton($name, array $values, $checked = null, $class = null, $classError = null)
 {
     $name = (string) $name;
     $values = (array) $values;
     $checked = $checked !== null ? (string) $checked : null;
     $class = $class !== null ? (string) $class : 'inputRadio';
     $classError = $classError !== null ? (string) $classError : 'inputRadioError';
     // create and return a radio button
     return parent::addRadiobutton($name, $values, $checked, $class, $classError);
 }
Exemple #3
0
 /**
  * Adds a single radio button.
  *
  * @param string $name       The name of the element.
  * @param array  $values     The possible values for the radio button.
  * @param string $checked    Should the element be checked?
  * @param string $class      Class(es) that will be applied on the element.
  *
  * @return \SpoonFormRadiobutton
  */
 public function addRadiobutton($name, array $values, $checked = null, $class = null)
 {
     $name = (string) $name;
     $values = (array) $values;
     $checked = $checked !== null ? (string) $checked : null;
     $class = $class !== null ? (string) $class : 'fork-form-radio';
     // create and return a radio button
     return parent::addRadiobutton($name, $values, $checked, $class);
 }