0
Zend_Form驗證需要javascript嗎?如果它發生了什麼,如果JS關閉,它會回落到正常的PHP驗證例如。做zend表單驗證需要javascript嗎?
對不起noob問題我只是無法找到任何文檔。
乾杯。
編輯:
這是我的形式:
class Application_Form_Test extends Zend_Form {
public function init() {}
public function testForm() {
$email = $this->createElement('text', 'email');
$email->setLabel('E-Mail Address');
$email->setRequired(true);
$email->addFilter('StripTags');
$email->addErrorMessage('an email address is required');
$email->addValidator('NotEmpty', true);
$email->addValidator('EmailAddress');
$submit = $this->createElement('submit', 'submit', array('label'=>'Submit'));
$this->addElements(
array(
$email, $submit
)
);
return $this;
}
}
,這是我的控制器:
class testController extends Zend_Controller_Action {
public function init() {
/* Initialize action controller here */
if(!Zend_Auth::getInstance()->hasIdentity()) {
$this->_redirect('login/index');
}
$this->_acl = new MyAcl(Zend_Auth::getInstance()->getIdentity());
}
public function indexAction() {
$form = new Application_Form_Test();
$form = $form->testForm();
$form->setAction('/dev/public/test/update')->setMethod('post');
$this->view->form = $form;
}
public function updateAction() {
$form = new Application_Form_Test();
if($this->getRequest()->isPost()){
$formData = $this->_request->getPost();
if($form->isValid($_POST)){
die('i seem to be valid....');
}
else{
die(var_dump($_POST));
}
}
}
}
這似乎驗證失敗。有任何想法嗎?