此表单中的所有功能都有效 - 获取最大余额和信用余额、会话功能等。但是,单击提交按钮时,什么也不做。它应该由该表单所在页面的控制器处理,但并没有那么远。没有请求帖子。如果有人可以帮助我,我将不胜感激。
<?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' => ''));
}
}