Zend Framework 1 - 提交按钮不起作用(点击后没有帖子)

时间:2013-10-07 19:36:22

标签: php zend-framework zend-form

此表单中的所有功能都有效 - 获取最大和贷方余额,会话功能等。但是,单击时,提交按钮不执行任何操作。它应该由控制器处理该表单所在的页面,但它没有那么远。没有请求帖子。如果有人能帮助我,我会非常感激。

<?php class Application_Form_Redeem extends Zend_Form
{
protected $identity;

public function init()
{

    //make sure it doesn't accept a number greater than available balance
    $this->identity = Zend_Auth::getInstance()->getIdentity();
    $username=$this->identity->username;    

    $users = new Application_Model_DbTable_User();
    $creditBal=$users->getCreditBal($username);

    //make sure it doesn't accept a number greater than maxRedemption
    $sess = new Zend_Session_Namespace('BusinessID');
    $retailerID = $sess->id;

    //echo "RETAILERID: " . $retailerID;

    $partners = new Application_Model_DbTable_Partners();
    $maxRedemption= $partners->getMaxRedemption($retailerID);       

    // Create a validator chain and add validators to it
    $validatorChain = new Zend_Validate();

    $validatorChain
        ->addValidator(new Zend_Validate_GreaterThan(array('min' => 0,)))
        ->addValidator(new Zend_Validate_LessThan(array('max' => $creditBal+0.01,)))
        ->addValidator(new Zend_Validate_LessThan(array('max' => $maxRedemption+0.01,)))
    ;

    $this->setMethod('post');
    $this->setName('Redeem-form');
    $this->setAttribs(array('style' => 'text-align:left;position:relative;'));

    $this->addElement('text', 'redeemAmount', array(
            'label' => '  n',
            'class' => 'redemptionAmount',
            'size' => '15',
            'required' => true,
            'validators' => array(

                    array(
                            'validator'     => $validatorChain,
                    ),                      
            ),//end validators aray
    ));

    $this->addDisplayGroup(array(
            'redeemAmount',                                     
    ),'redemptionAmount', array('legend' => ''));


    $this->addElement('submit', 'submitRedemption', array(
            'ignore' => true,
            'class' => 'redeem',
            'label' => 'Redeem ',
    ));


    $this->addDisplayGroup(array(
            'submitRedemption',
    ),'submitRedemption', array('legend' => ''));
}

}

0 个答案:

没有答案