2009年7月31日星期五

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



没有评论: