public function create() { $form = $this->baseFormFactory->create(); $form->addText('email', 'Email')->setType('email')->addRule(Form::EMAIL); $form->addRadioList('skin', 'Skin', $this->skins)->setRequired(); $form->setValues($this->setting->getValues()); $form->addSubmit('submit', 'Save'); $form->onSuccess[] = $this->process; return $form; }
public function create($id) { $this->id = $id; $form = $this->baseFormFactory->create(); $form->addSelect('quantity', 'Quantity', array_combine(range(1, 5), range(1, 5))); $container = $form->addContainer('options'); foreach ($this->options as $key => $values) { $container->addSelect($key, $key, $values)->setPrompt(NULL)->setRequired(); } $form->addSubmit('submit', 'Add to Cart'); $form->onSuccess[] = $this->process; return $form; }
public function create() { $form = $this->baseFormFactory->create(); if ($this->username == 'email') { $form->addText('username', 'Email')->setAttribute('placeholder', 'Email')->setRequired('Please enter your email.')->addRule(Form::EMAIL, 'Please enter a valid email address.'); } else { $form->addText('username', 'Username')->setAttribute('placeholder', 'Username')->setRequired('Please enter your username.'); } $form->addPassword('password', 'Password')->setAttribute('placeholder', 'Password')->setRequired('Please enter your password.'); $form->addCheckbox('remember', 'Remember Me'); $form->addSubmit('submit', 'Sign In'); $form->onSuccess[] = $this->process; return $form; }
public function create($id = NULL) { $this->id = $id; $form = $this->baseFormFactory->create(); $this->setupForm($form); if ($id) { $this->row = $this->database->table($this->table)->get($id); if (!$this->row) { throw new InvalidArgumentException('Row not found.'); } $form->setValues($this->row); } $form->onSuccess[] = $this->process; return $form; }
public function create() { $form = $this->baseFormFactory->create(); $form->addGroup('Contact'); $form->addText('name', 'Name')->setRequired(); $form->addText('phone', 'Phone')->setRequired(); $form->addText('email', 'Email')->setRequired()->setType("email")->addRule(Form::EMAIL); $form->addGroup('Address'); $form->addText('street', 'Street')->setRequired(); $form->addText('city', 'City')->setRequired(); $form->addText('zip', 'Zip')->setRequired(); $form->addGroup('Description'); $form->addTextArea('description', 'Description', NULL, 5); $form->addSubmit('submit', 'Submit'); $form->onSuccess[] = $this->process; return $form; }