public function setup() { $this->widgetSchema['email_address'] = new sfWidgetFormInputText(); $this->validatorSchema['email_address'] = new sfGuardValidatorUsernameOrEmail(array('trim' => true), array('required' => 'Your username or e-mail address is required.', 'invalid' => 'Username or e-mail address not found please try again.')); $this->widgetSchema->setNameFormat('forgot_password[%s]'); parent::setup(); }
public function setup() { $this->setWidgets(array('importer' => new sfWidgetFormChoice(array('choices' => self::$importers, 'expanded' => false)), 'file' => new sfWidgetFormInputFile())); $this->setValidators(array('importer' => new sfValidatorChoice(array('choices' => array_keys(self::$importers))), 'file' => new sfValidatorFile(array('required' => true, 'max_size' => 100000, 'path' => sfConfig::get('sf_upload_dir') . '/imports', 'mime_types' => 'gps_files', 'mime_categories' => array('gps_files' => array('application/octet-stream')))))); $this->widgetSchema->setNameFormat('import[%s]'); $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema); parent::setup(); }
public function setup() { $lI18n = sfContext::getInstance()->getI18N(); $this->setWidgets(array('single_code' => new sfWidgetFormInputText(), 'multiple_codes' => new sfWidgetFormTextarea())); $this->setValidators(array('single_code' => new sfValidatorString(array("required" => false, 'trim' => true)), 'multiple_codes' => new sfValidatorString(array("required" => false, 'trim' => true)))); $this->widgetSchema->setNameFormat('coupon[%s]'); parent::setup(); }
/** * @see sfForm */ public function setup() { parent::setup(); $this->setWidgets(array('username' => new sfWidgetFormInputText(), 'password' => new sfWidgetFormInputPassword(), 'remember' => new sfWidgetFormInputCheckbox())); $this->setValidators(array('username' => new sfValidatorString(), 'password' => new sfValidatorString(), 'remember' => new sfValidatorBoolean())); $this->setName('signin'); $this->validatorSchema->setPostValidator(new dmValidatorUser()); }
public function setup() { $this->setWidgets(array('Nom' => new sfWidgetFormInputText(array(), array('style' => 'width:400px')), 'Cognoms' => new sfWidgetFormInputText(array(), array('style' => 'width:400px')), 'Telefon' => new sfWidgetFormInputText(array(), array('style' => 'width:400px')), 'Email' => new sfWidgetFormInputText(array(), array('style' => 'width:400px')), 'Missatge' => new sfWidgetFormTextarea(array(), array('style' => 'width:400px')))); $this->setValidators(array('Nom' => new sfValidatorString(), 'Cognoms' => new sfValidatorString(), 'Telefon' => new sfValidatorString(), 'Email' => new sfValidatorString(), 'Missatge' => new sfValidatorString())); $this->widgetSchema->setLabels(array('Nom' => 'Nom: ', 'Cognoms' => 'Cognoms: ', 'Telefon' => 'Telèfon: ', 'Email' => 'Correu electrònic: ', 'Missatge' => 'Missatge: ')); $this->widgetSchema->setNameFormat('consulta[%s]'); $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema); parent::setup(); }
/** * @see sfForm */ public function setup() { $this->setWidgets(array('username' => new sfWidgetFormInputText(), 'password' => new sfWidgetFormInputPassword(array('type' => 'password')), 'remember' => new sfWidgetFormInputCheckbox())); $this->setValidators(array('username' => new sfValidatorString(), 'password' => new sfValidatorString(), 'remember' => new sfValidatorBoolean())); if (sfConfig::get('app_sf_guard_plugin_allow_login_with_email', true)) { $this->widgetSchema['username']->setLabel('Username or E-Mail'); } $this->validatorSchema->setPostValidator(new sfGuardValidatorUser()); $this->widgetSchema->setNameFormat('signin[%s]'); parent::setup(); }
public function setup() { $this->widgetSchema->setNameFormat('contacto[%s]'); $this->setWidget('nombre', new sfWidgetFormInput()); $this->setValidator('nombre', new sfValidatorString(array('required' => true), array('required' => 'Se requiere ingresar un nombre'))); $this->setWidget('email', new sfWidgetFormInput()); $this->setValidator('email', new sfValidatorEmail(array('required' => true), array('required' => 'Se requiere una direccion de e-mail'))); $this->setWidget('comentario', new sfWidgetFormTextarea()); $this->setValidator('comentario', new sfValidatorString(array('required' => true), array('required' => 'Se requiere un comentario'))); parent::setup(); }
public function setup() { $typeChoices = array('' => '', 'mysql' => 'MySQL', 'sqlite' => 'Sqlite', 'pgsql' => 'PostgreSQL', 'oracle' => 'Oracle Adapter', 'oci' => 'Oracle PDO', 'mssql' => 'MsSQL'); $this->setWidgets(array('type' => new sfWidgetFormChoice(array('choices' => $typeChoices)), 'host' => new sfWidgetFormInput(), 'name' => new sfWidgetFormInput(), 'username' => new sfWidgetFormInput(), 'password' => new sfWidgetFormInputPassword())); $this->setValidators(array('type' => new sfValidatorChoice(array('required' => false, 'choices' => array_keys($typeChoices))), 'host' => new sfValidatorString(array('required' => false)), 'name' => new sfValidatorString(array('required' => false)), 'username' => new sfValidatorString(array('required' => false)), 'password' => new sfValidatorString(array('required' => false)))); $this->widgetSchema->setLabel('name', 'Database Name'); $this->widgetSchema['password'] = new sfWidgetFormInputPassword(); $this->widgetSchema['password_again'] = new sfWidgetFormInputPassword(); $this->validatorSchema['password_again'] = clone $this->validatorSchema['password']; $this->widgetSchema->setNameFormat('database[%s]'); $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema); $this->mergePostValidator(new sfValidatorSchemaCompare('password', sfValidatorSchemaCompare::EQUAL, 'password_again', array(), array('invalid' => 'The two passwords must be the same.'))); parent::setup(); }
/** * Overridden to allow the app to add to the form and then to process * those additions and turn them into one giant, embedded form */ public function setup() { // allow the application to add fields to the form self::$dispatcher->notify(new sfEvent($this, 'sympal.load_config_form')); $otherSettings = array(); foreach ($this->_settings as $group => $settings) { if (!is_numeric($group)) { $form = new BaseForm(); foreach ($settings as $setting) { $form->setWidget($setting['name'], $setting['widget']); $form->getWidgetSchema()->setLabel($setting['name'], $setting['label']); $form->setValidator($setting['name'], $setting['validator']); } $this->embedForm($group, $form); } else { $otherSettings[] = $settings; } } foreach ($otherSettings as $setting) { $this->setWidget($setting['name'], $setting['widget']); $this->getWidgetSchema()->setLabel($setting['name'], $setting['label']); $this->setValidator($setting['name'], $setting['validator']); } $defaults = $this->getDefaults(); foreach ($this as $key => $value) { if ($value instanceof sfFormFieldSchema) { foreach ($value as $k => $v) { $defaults[$key][$k] = sfSympalConfig::get($key, $k); } } else { $defaults[$key] = sfSympalConfig::get($key); } } $this->setDefaults($defaults); $this->widgetSchema->setNameFormat('settings[%s]'); $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema); parent::setup(); }
public function setup() { $this->setWidgets(array('email' => new sfWidgetFormInputText())); $this->setValidators(array('email' => new sfValidatorEmail())); parent::setup(); }