Zend表格提交无效

时间:2010-01-28 01:53:58

标签: php zend-framework dojo zend-form

我正在尝试提交一份表格。当我单击按钮提交表单时,表单不执行任何操作(它也不会刷新页面)。我有以下创建活动页面:

<?php
class Form_CreateEvent extends Form_DisplayEvent
{
    public function init()
    {
     require_once('createEventInformation.php');
     require_once('createCategoryDetail.php');
     require_once('createEventDetail.php');
     require_once('createFeeDetail.php');
        require_once('createQuestionDetail.php');
     require_once('createWaiverDetail.php');

     //parent::init();
        Zend_Dojo::enableForm($this);

     $this->setDecorators(array(
     'FormElements',
     array('TabContainer', array(
     'id' => 'tabContainer',
     'style' => 'width: 100%; ',
     'dijitParams' => array(
     'tabPosition' => 'left',
     'doLayout' => false
     ),
     )),
     'DijitForm',
     ));        

        $this->setName('createEventForm');
        $this->setAction('/admin/createevent/')
                     ->setMethod('post'); 
               // Create and Add Submit Button for Full Form
        $final_submit = new Zend_Dojo_Form_Element_SubmitButton('final_submit');
        $final_submit->setLabel('Save Event');
        $this->addElement($final_submit);


  //$subForm3 = new Zend_Dojo_Form_SubForm();
  $subFormEventInformation = new Form_CreateEventInformation(); // extends Zend_Form

  $subFormEventInformation->setAttribs(array(
  'name'   => 'eventInformation',
  'legend' => 'Event Information',
  'style' => 'height: 100%',
  'dijitParams' => array(
  'title' => 'Event Information',
  ),
  ));

  $subFormEventDetail = new Form_CreateEventDetail(); // extends Zend_Form

  $subFormEventDetail->setAttribs(array(
  'name'   => 'eventDetail',
  'legend' => 'Event Detail',
  'dijitParams' => array(
  'title' => 'Event Detail',
  ),
  ));

  $subFormCategoryDetail = new Form_CreateCategoryDetail(); // extends Zend_Form

  $subFormCategoryDetail->setAttribs(array(
  'name'   => 'categoryDetail',
  'legend' => 'Category Detail',
  'dijitParams' => array(
  'title' => 'Category Detail',
  ),
  ));

  $subFormFeeDetail = new Form_CreateFeeDetail(); // extends Zend_Form

  $subFormFeeDetail->setAttribs(array(
  'name'   => 'feeDetail',
  'legend' => 'Fee Detail',
  'dijitParams' => array(
  'title' => 'Fee Detail',
  ),
  ));

  $subFormQuestionDetail = new Form_CreateQuestionDetail(); // extends Zend_Form

  $subFormQuestionDetail->setAttribs(array(
  'name'   => 'questionDetail',
  'legend' => 'Question Detail',
  'dijitParams' => array(
  'title' => 'Question Detail',
  ),
  ));

  $subFormWaiverDetail = new Form_CreateWaiverDetail(); // extends Zend_Form

  $subFormWaiverDetail->setAttribs(array(
  'name'   => 'waiverDetail',
  'legend' => 'Waiver Detail',
  'dijitParams' => array(
  'title' => 'Waiver Detail',
  ),
  ));  

     $this->addSubForm($subFormEventDetail, 'eventDetail')
       ->addSubForm($subFormEventInformation, 'eventInformation')
       ->addSubForm($subFormCategoryDetail, 'categoryDetail')
       ->addSubForm($subFormFeeDetail, 'feeDetail')
       ->addSubForm($subFormQuestionDetail, 'questionDetail')
       ->addSubForm($subFormWaiverDetail, 'waiverDetail'); 
    }
}
?>

我有以下adminController

<?php

class AdminController extends Zend_Controller_Action
{

    public function init()
    {
        /* Initialize action controller here */
    }

    public function createeventAction()
    {
        $this->view->page = 'createEvent';     
     $this->view->title = "Early Signup Administration";
     $this->view->headTitle($this->view->title, 'PREPEND');

     $createEventForm = new Form_CreateEvent();
      $request = $this->getRequest();   
     if ($request->isPost()) 
     {

   if( !$form->isValid($request->getPost() ) )
   {
       $this->view->form = $createEventForm;
       // renders view script
       return;
   }
   else
   {
    echo 'submitted2';
   }
  }
  else
  {
      $this->view->form = $createEventForm;
  }
        /*if ($this->_request->isPost()) {
            $formData = $this->_request->getPost();
            if ($formData->isValid($formData)) {
                echo 'success';
                exit;
            } else {
                $createEventForm->populate($formData);
            }
        }
        else
        {
                  $this->view->form = $createEventForm;
        }     */



    }

    public function createeventinformationAction()
    {
        $this->view->page = 'createEventInformation';     
     $this->view->title = "Add Event Information";
     $this->view->headTitle($this->view->title, 'PREPEND');

     $createEventInformationForm = new Form_CreateEventInformation();
  $this->view->form = $createEventInformationForm;        
    }

    public function createquestiondetailAction()
    {
        $this->view->page = 'createquestiondetail';     
     $this->view->title = "Add Question Detail";
     $this->view->headTitle($this->view->title, 'PREPEND');

     $createQuestionDetailForm = new Form_CreateQuestionDetail();
     $this->view->form = $createQuestionDetailForm;        
    }

    public function createwaiverdetailAction()
    {
        $this->view->page = 'createwaiverdetail';     
     $this->view->title = "Add Waiver Detail";
     $this->view->headTitle($this->view->title, 'PREPEND');

     $createWaiverDetailForm = new Form_CreateWaiverDetail();
     $this->view->form = $createWaiverDetailForm;        
    }

        public function createcategorydetailAction()
    {
        $this->view->page = 'createCategoryDetail';     
     $this->view->title = "Add Category Detail";
     $this->view->headTitle($this->view->title, 'PREPEND');

     $createCategoryDetailForm = new Form_CreateCategoryDetail();
     $this->view->form = $createCategoryDetailForm;        
    }

        public function createfeedetailAction()
    {
        $this->view->page = 'createFeeDetail';     
     $this->view->title = "Add Fee Detail";
     $this->view->headTitle($this->view->title, 'PREPEND');

     $createFeeDetailForm = new Form_CreateFeeDetail();
     $this->view->form = $createFeeDetailForm;        
    }

    public function createuserAction()
    {
        $this->view->page = 'createUser';     
     $this->view->title = "Add User";
     $this->view->headTitle($this->view->title, 'PREPEND');

     $createUserForm = new Form_CreateUser();
     $this->view->form = $createUserForm;        
    }

 public function neweventinformationAction() 
 {
    $ajaxContext = $this->_helper->getHelper('AjaxContext');
     $ajaxContext->addActionContext('neweventinformation', 'html')->initContext();

    $idEventInformationPassed = $this->_getParam('idEventInformationPassed', null);
    $idEventInformationPassed++;
    $Form_CreateEventInformation = new Form_CreateEventInformation();
    $this->view->form = $Form_CreateEventInformation->buildBlock(array('idEventInformationPassed' => $idEventInformationPassed));
 }

}

1 个答案:

答案 0 :(得分:0)

未提交的表单通常是缺少或格式错误的开放<form>标记的症状。