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')); }
/** * Adds a multiple checkbox. * * @param string $name The name of the element. * @param array $values The values for the checkboxes. * @param mixed[optional] $checked Should the checkboxes 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 SpoonFormMultiCheckbox */ public function addMultiCheckbox($name, array $values, $checked = null, $class = null, $classError = null) { $name = (string) $name; $values = (array) $values; $checked = $checked !== null ? (array) $checked : null; $class = $class !== null ? (string) $class : 'inputCheckbox'; $classError = $classError !== null ? (string) $classError : 'inputCheckboxError'; // create and return a multi checkbox return parent::addMultiCheckbox($name, $values, $checked, $class, $classError); }
/** * Adds a multiple checkbox. * * @param string $name The name of the element. * @param array $values The values for the checkboxes. * @param mixed $checked Should the checkboxes be checked? * @param string $class Class(es) that will be applied on the element. * * @return \SpoonFormMultiCheckbox */ public function addMultiCheckbox($name, array $values, $checked = null, $class = null) { $name = (string) $name; $values = (array) $values; $checked = $checked !== null ? (array) $checked : null; $class = $class !== null ? (string) $class : 'fork-form-multi-checkbox'; // create and return a multi checkbox return parent::addMultiCheckbox($name, $values, $checked, $class); }