pastebin - collaborative debugging

pastebin is a collaborative debugging tool allowing you to share and modify code snippets while chatting on IRC, IM or a message board.

This site is developed to XHTML and CSS2 W3C standards. If you see this paragraph, your browser does not support those standards and you need to upgrade. Visit WaSP for a variety of options.

jeremykendall private pastebin - collaborative debugging tool What's a private pastebin?


Posted by Jeremy Kendall on Wed 21 Jan 12:29
report abuse | download | new post

  1. <?php
  2.  
  3. /**
  4.  * FormsController
  5.  *
  6.  * @author Jeremy Kendall <jeremy@jeremykendall.net>
  7.  */
  8.  
  9. require_once 'Zend/Controller/Action.php';
  10.  
  11. class FormsController extends Zend_Controller_Action {
  12.  
  13.   /**
  14.    * The default action - show the home page
  15.    */
  16.   public function indexAction() {
  17.     // TODO Auto-generated FormsController::indexAction() default action
  18.   }
  19.  
  20.   /**
  21.    * Shows the dynamic form demonstration page
  22.    */
  23.   public function dynamicFormElementsAction() {
  24.        
  25.     $form = new Code_Form_Dynamic();
  26.    
  27.     // Form has not been submitted - pass to view and return
  28.     if (!$this->getRequest()->isPost()) {
  29.       $this->view->form = $form;
  30.       return;
  31.     }
  32.  
  33.      // Form has been submitted - run data through preValidation()
  34.     $form->preValidation($_POST);
  35.    
  36.      // If the form doesn't validate, pass to view and return
  37.     if (!$form->isValid($_POST)) {
  38.       $this->view->form = $form;
  39.       return;
  40.     }
  41.    
  42.      // Form is valid
  43.     $this->view->form = $form;
  44.   }
  45.  
  46.   /**
  47.    * Ajax action that returns the dynamic form field
  48.    */
  49.   public function newfieldAction() {
  50.    
  51.     $ajaxContext = $this->_helper->getHelper('AjaxContext');
  52.     $ajaxContext->addActionContext('newfield', 'html')->initContext();
  53.    
  54.     $id = $this->_getParam('id', null);
  55.    
  56.     $element = new Zend_Form_Element_Text("newName$id");
  57.     $element->setRequired(true)->setLabel('Name');
  58.    
  59.     $this->view->field = $element->__toString();
  60.   }
  61. }

Submit a correction or amendment below (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.

Syntax highlighting:

To highlight particular lines, prefix each line with @@


Remember me so that I can delete my post