I have an ajaxSubmitButton in an AJAX lightbox (aka. modal window, using shadowbox if that matters) and I’m getting some strange behavior.
Basically if I submit the form, close the box, then open it again (which should be loaded fresh)it submits it twice when I press the submit button. In-fact it seems to do it proportional to how many times I have opened submitted the form already, for example if I have submitted the form 5 times it will call the controller 5 times.
It’s a real problem because this is forming the checkout of a cart and if I have made submitted the form (and say it doesn’t validate) then I submit it again, it places two orders. I can’t possibly see why this would be happening because everything is loaded fresh via AJAX.
Anyone have any ideas? I’m not really sure what code to post as I have no idea where this problem is originating from.
Actually that makes sense, you see I didn’t use a renderPartial, rather I used render with a stripped down layout because otherwise the JavaScript required to make the ajaxSubmitButton work contained in the ajax rendered view work wouldn’t be returned. Is there any way I can use renderPartial but still have it return the JS that’s needed for the form?