embedForm('thread', new ThreadForm()); } } // thread form - autogenerated class ThreadForm extends BaseThreadForm { public function configure() { $this->useFields(array( 'body', )); } // base thread form - autogenerated abstract class BaseThreadForm extends BaseFormDoctrine { public function setup() { $this->setWidgets(array( 'id' => new sfWidgetFormInputHidden(), 'body' => new sfWidgetFormTextarea(), )); $this->setValidators(array( 'body' => new sfValidatorString(array('max_length' => 10000)), )); $this->validatorSchema->setPostValidator( new sfValidatorDoctrineUnique(array('model' => 'Thread', 'column' => array('id'))) ); $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema); $this->setupInheritance(); parent::setup(); } // the controller public function executeIndex(sfWebRequest $request) { $this->form = new swThreadForm(); } public function executeCreate(sfWebRequest $request) { $this->form = new swThreadForm(); if ($request->isMethod('post')) { $this->form->bind($request->getParameter('thread')); if ($this->form->isValid()) { $this->redirect('thread/welcome?' . http_build_query($this->form->getValues())); } } $this->setTemplate('index'); } // the index template
renderLabel() ?> renderError() ?> // i always get REQUIRED no matter what i post render() ?>