开发者

Server side extjs form validation using zend framework

Server side extjs form validation using zend framework

I have extended Zend_Form class to validate my client side extjs form:

  class Application_Form_NewBugReport extends Zend_Form {

public function init() {
    // Set the method for the display form to POST
    //here we go with different elements
    }}

Then added this code to my controller:

public function submitformAction() {

    // Instantiate the registration form model
    $form = new Application_Form_NewBugReport ();
    $form->setAction('/newbugreport/submitf开发者_高级运维orm');
    fb ( $form->getValues() );
    }

But values are empty and I can`t get form values because zend says form values are empty while they are not and I can get them using $this->_request->getPost () (and of course without any validations) What is the proper solution for validating forms when you don't actually use ZF forms and use client side javascript to create forms?


You'll need to validate the form against some input, in this case the POST data:

$form->setAction('/url');
if ($form->isValid($this->getRequest()->getPost())) {
    fb($form->getValues());
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜