ajax multiple submission

hi,

I read this tutorial,

http://www.yiiframework.com/wiki/72/cjuidialog-and-ajaxsubmitbutton

it is a great one,

however

it submits the form 2 times, and sometimes 3 times.

the author has added a comment, which does not seem to solve the problem.




/*This will fix multiple ajax submittion problem */

/* Use the below undelegate function to destroy JQuery event. 

Otherwise when you open dialog 1st time, It will do ajax submission 1 time, 

if you open 2end time, It will submit 2 times etc.. 

You could see the ajax submission in firebug */ 


$this->beginWidget('zii.widgets.jui.CJuiDialog',array( 

'id'=>"dmaDialog", 

'options'=>array( 

'closeOnEscape'=>true, 

'title'=>Yii::t("dma",'CREATE DMA'), 

'autoOpen'=>true, 

'modal'=>'true', 

'width'=>'450px', 

'height'=>'auto', 

'resizable' =>false, 

'close'=>"js:function(e,ui){


jQuery('body').undelegate('#closeDmaDialog', 'click');


                    jQuery('#dmaDialog').empty();

                 }",

            ),

            ));

this solution does not help at all.

the tutorial is really good benefit, but this error looks like the fly in the ointment, big fly.

any suggestions?

try something like this:


<script>

$("form").live("submit",function(){

$(this).find(":submit").attr("disable",false);

});

</script>

Thank you Ekstazi for your reply,

I tried it and have no effect.

okay,

I will correct myself,

that tutorial was not great. it wasn’t even good.

if it was good, then what would we call this one?

http://www.yiiframework.com/wiki/145/cjuidialog-for-create-new-model

it is very very very simple, smart, and straight forward.

very suitable for beginners

Hi, Aladdin. Can you explain please how you have solved your problem with multiple submission? I’ve just read this link you posted. But I don’t send a form. There are only ajax links. And when i click on another user(I have table of users and personal info displayed in CJuiDialog. I can change some fields using ajax links) and use my ajax links - it works correctly only on the first time (or after reloading page) in other cases there is a same problem with multiple submission.