/** * @return Form */ function create() { $form = new Form(); $form->addUpload('file', 'Select file')->setRequired(); $form->addTextArea('note', 'Your note'); $form->addSubmit('process', 'Upload'); $form->onSuccess[] = $this->solutionFormSucceeded; return BootstrapForm::makeBootstrap($form); }
/** * @return Form */ protected function createComponentRegisterForm() { $form = new Form(); $form->addText('username', 'Username')->addRule(Form::MIN_LENGTH, 'Username must be at least 4 characters long.', 4)->addRule(Form::PATTERN, 'Only alphanumeric characters are allowed in username.', "^[a-zA-Z0-9]*\$")->setRequired(); $form->addText('email', 'E-mail')->setRequired(); $form->addPassword('password', 'Password')->addRule(Form::MIN_LENGTH, 'Password must be at least 6 characters long.', 6)->setRequired()->setOption('description', 'Password must be at least 6 characters long.'); $form->addPassword('password2', 'Check password')->setRequired()->addRule(Form::EQUAL, 'Password does not match.', $form['password'])->setOmitted()->setOption('description', 'Enter you password again.'); $form->addText('name', 'Your name'); $form->addSubmit('process', 'Create'); $form->onSuccess[] = $this->registerFormSucceeded; return BootstrapForm::makeBootstrap($form); }
/** * @return Form */ function createComponentProjectForm() { $form = new Form(); $form->addText('name', 'Project name')->setRequired(); $form->addText('tags', 'Tags')->setOption('description', 'Comma-delimited project tags e.g. PostgreSQL, MS SQL etc.'); $form->addTextArea('description', 'Project description')->setAttribute('rows', 10)->setOption('description', 'You can use Markdown syntax.')->setRequired(); $form->addSubmit('process', 'Create'); $form->onSuccess[] = $this->projectFormSucceeded; return BootstrapForm::makeBootstrap($form); }
function createComponentPwdForm() { $form = new Form(); $form->addPassword('password', 'Password')->addRule(Form::MIN_LENGTH, 'Password must be at least 6 characters long.', 6)->setRequired()->setOption('description', 'Password must be at least 6 characters long.'); $form->addPassword('password2', 'Check password')->setRequired()->addRule(Form::EQUAL, 'Password does not match.', $form['password'])->setOmitted()->setOption('description', 'Enter you password again.'); $form->addSubmit('process', 'Change password'); $form->onSuccess[] = $this->pwdFormSucceeded; return BootstrapForm::makeBootstrap($form); }