Because I have multiple forms in one page and would like my application to be cool Also submitting some of the forms takes a while so i would like to use the loading class to indicate that the website is thinking…that kind of stuff
I don’t know, Never had this sort of behavior. Maybe there something in your code that does that. I can try and reproduce the same issue if you share your code with us.
When the above code is placed directly in the view file all works fine. When however placed in the view file via renderPartial it always submits the form twice. If I have two such forms through renderPartial it submits 4 times no matter that only one form is submitted. I’ve made sure all ajaxSubmitButtons have unique names and the forms have unique names.
Interesting. I assigned a unique parameter to each renderPartial. All came down to the conclusion that each renderPartial submit itself twice. Not sure why. Did another test by declaring the renderPartial like this:
I don’t know why you started to use the fourth parameter of renderPartial set to true (IIRC in another thread you were advised to use it).
With the jQuery.live() call used in recent versions of CHtml I guess a lot of event rearming kind of problems went away. But I can’t imagine every possible case.
With the fourth parameter set to true, one problem is that jQuery may be included more than once
See this thread.
A worse problem (that’s probably what hit you) is that multiple jQuery stubs would be generated in the document.ready script section.
I don’t know the exact reason why some people (some configurations) run into problems. Like others suggested, perhaps a hardware and browser dependent DOM update race condition. Possibly it might be a good idea to modify CHtml to set of a delay before modifying jQuery stubs. I’m just guessing here, didn’t investigate.
This thread is old but I’ll reply because it comes up in google search results.
Two submits is usually because of Ajax validation, which does the extra submit before the real one. If that’s not processed right, it will behave as two functional submits.
If you have AjaxValidation enabled on the form view page, you must:
Enable it in your controller for that form (default CRUD generation has it commented out)
Make sure the form name (e.g. “user-form”) on the form is the same name as used in the controller’s performAjaxValidation test.
While your answer are useful with respect to the thread title, the above scenario doesn’t involve CActiveForm, so ajax validation isn’t used in this case.
Hi, I know this is a very old thread, but I’m having a similar issue where it’s doing two submits. The problem, though, is that if I change the fourth parameter of renderPartial() to false, then my time-pickers and sliders (which are dynamically loaded) don’t display on the form.