2009年7月31日星期五

RE: [fw-mvc] Using Ajax with Zend

 

Dear Simone,

 

Hello ! Thanks for the prompt response.

 

I am also trying with Zend_Form_Dojo. The example you gave is not full, I am new to Zend so don’t know which code to write where, I meant in controller, model or view and where to add the mentioned java script code with some example validation.

 

Can you please give more details as mentioned above or link where I can read and use.

 

Also I have seen $this->dojo()->setLocalPath(’http://localhost/Zend/js/dojo/dojo/dojo.js’) in some examples, but I could not find dojo.js in Zend framework 1.8.4 library, how to find and keep it.

 

Thanks in Advance !

 

Naimesh

From: Simone Cosci [mailto:s.cosci@nextidea.it]
Sent: Friday, July 31, 2009 7:16 PM
To: fw-general@lists.zend.com
Cc: fw-mvc@lists.zend.com
Subject: Re: [fw-mvc] Using Ajax with Zend

 

Naimesh.Trivedi (Gmail) ha scritto:

Hello !

 

I want to use Ajax in my Zend based input forms, should I used Zend_Form or Zend_Dojo_Form ?

Can anybody help me showing a link of example of ajax enabled form using above ?

 

Thanks in Advance !

 

Naimesh

 

 

I think you can choose the one you prefere ...
I use dojo only to XmlHttpRequest
in my case important is:

$form->setAttrib('onsubmit', 'sendAjaxForm(this)');

then a JS to handle the post and the server response:
eg.

function sendAjaxForm(frm)
{
    var kw = {
            url: frm.action,
            handleAs: "text",
            load: function(response){
                dojo.byId('mainPane').innerHTML =  response;
            },
//            postprocess: doSomethingElseAfterPost,
            error: function(data){
                alert("sendAjaxForm() timed out: " + data);
            },
            timeout: 2000,
            form: frm.id
        };
    dojo.xhrPost(kw);
    return false;
}

bye

--
fsockopen
ZF n00b


没有评论: