daily pastebin goal
21%
SHARE
TWEET

Untitled

a guest Aug 14th, 2018 59 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. // Form
  3. class ContentDirectorySearchForm extends sfForm
  4. {
  5.   public function setup()
  6.   {
  7.     $this->setWidgets(array(
  8.       'street_address' => new sfWidgetFormInputText(),
  9.       'city'           => new sfWidgetFormInputText(),
  10.       'state'          => new sfWidgetFormInputText(),
  11.       'zipcode'        => new sfWidgetFormInputText(),
  12.     ));
  13.  
  14.     $this->setValidators(array(
  15.       'street_address' => new sfValidatorString(array('max_length' => 250, 'required' => false)),
  16.       'city'           => new sfValidatorString(array('max_length' => 250, 'required' => false)),
  17.       'state'          => new sfValidatorString(array('max_length' => 2, 'required' => false)),
  18.     ));
  19.  
  20.     $this->widgetSchema->setNameFormat('content_directory[%s]');
  21.  
  22.     $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);
  23.  
  24.     parent::setup();
  25.   }
  26.  
  27.   public function getModelName()
  28.   {
  29.     return 'ContentDirectory';
  30.   }
  31. }
  32.  
  33.  
  34. // Action
  35. class directoryActions extends sfActions
  36. {
  37.   public function executeIndex(sfWebRequest $request)
  38.   {
  39.     $this->form = new ContentDirectorySearchForm();
  40. //    $this->form = new ContentDirectoryFormFilter();
  41.   }
  42.  
  43.   public function executeSearch(sfWebRequest $request)
  44.   {
  45.     // restrict to POST requests only
  46.     $this->forward404Unless($request->isMethod("post"));
  47.  
  48.     $this->form = new ContentDirectorySearchForm();
  49.     $this->form->bind($request->getParameter($this->form->getName()));
  50.     var_dump($this->form->getValue('zipcode'));
  51.   }
  52.  
  53.   public function executeShow(sfWebRequest $request)
  54.   {
  55.     $this->contentdirectory = Doctrine_Core::getTable('contentdirectory')->find(array($request->getParameter('id')));
  56.     $this->forward404Unless($this->contentdirectory);
  57.   }
  58. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top