Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Form
- class ContentDirectorySearchForm extends sfForm
- {
- public function setup()
- {
- $this->setWidgets(array(
- 'street_address' => new sfWidgetFormInputText(),
- 'city' => new sfWidgetFormInputText(),
- 'state' => new sfWidgetFormInputText(),
- 'zipcode' => new sfWidgetFormInputText(),
- ));
- $this->setValidators(array(
- 'street_address' => new sfValidatorString(array('max_length' => 250, 'required' => false)),
- 'city' => new sfValidatorString(array('max_length' => 250, 'required' => false)),
- 'state' => new sfValidatorString(array('max_length' => 2, 'required' => false)),
- ));
- $this->widgetSchema->setNameFormat('content_directory[%s]');
- $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);
- parent::setup();
- }
- public function getModelName()
- {
- return 'ContentDirectory';
- }
- }
- // Action
- class directoryActions extends sfActions
- {
- public function executeIndex(sfWebRequest $request)
- {
- $this->form = new ContentDirectorySearchForm();
- // $this->form = new ContentDirectoryFormFilter();
- }
- public function executeSearch(sfWebRequest $request)
- {
- // restrict to POST requests only
- $this->forward404Unless($request->isMethod("post"));
- $this->form = new ContentDirectorySearchForm();
- $this->form->bind($request->getParameter($this->form->getName()));
- var_dump($this->form->getValue('zipcode'));
- }
- public function executeShow(sfWebRequest $request)
- {
- $this->contentdirectory = Doctrine_Core::getTable('contentdirectory')->find(array($request->getParameter('id')));
- $this->forward404Unless($this->contentdirectory);
- }
- }
Add Comment
Please, Sign In to add comment