コード例 #1
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'));
 }
コード例 #2
0
ファイル: form.php プロジェクト: nickmancol/forkcms-rhcloud
 /**
  * Adds a single file field.
  *
  * @param string $name Name of the element.
  * @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 SpoonFormFile
  */
 public function addFile($name, $class = null, $classError = null)
 {
     $name = (string) $name;
     $class = $class !== null ? (string) $class : 'inputFile';
     $classError = $classError !== null ? (string) $classError : 'inputFileError';
     // create and return a filefield
     return parent::addFile($name, $class, $classError);
 }