示例#1
0
 public function createComponentForm()
 {
     $form = new MyForm();
     $form->renderStyle = MyForm::SEMANTIC;
     $form->setTranslator($this->translator);
     $form->addText('name', 'Name');
     $form->addText('surname', 'Surname');
     $form->addText('homepage', 'Homepage URL');
     $form->addText('telephone', 'Telephone');
     $form->addText('street', 'Street');
     $form->addText('city', 'City');
     $form->addSelect('country_id', 'Country', $this->context->createServiceCountries()->order('name')->fetchPairs('id', 'name'))->setDefaultValue(208);
     $form->addText('zip', 'Zip code');
     $form->addText('icq', 'ICQ');
     $form->addText('skype', 'Skype');
     $form->addText('aim', 'AIM');
     $form->addText('jabber', 'Jabber');
     $form->addDatepicker('birthday', 'Birthday');
     $form->addSelect('language_id', 'Language', $this->context->createServiceLangs()->fetchPairs('id', 'name'))->setDefaultValue(1);
     $form->addRadioList('sex', 'Sex', array('M' => 'male', 'F' => 'female'))->setDefaultValue('M');
     $form->addTextArea('description', 'Description');
     $form->addText('organization', 'Organization');
     $form->addSubmit('save', 'Save');
     $form->onSuccess[] = callback($this, 'saveProfile');
     $form->setDefaults($this->profile);
     return $form;
 }