yiisoft / jquery-pjax

pushState + ajax = pjax
http://pjax.herokuapp.com
MIT License
144 stars 40 forks source link

Form getting submitted multiple time #65

Closed ak868308 closed 7 years ago

ak868308 commented 7 years ago

Hi I am using bootstrap modal popup and rendering the form into modal poup. For the first time when modal popup opens everything is fine but the problem starts from second time. If again I opened the same modal popup without refreshing the page for adding the second record then 2 request being sent first one gets cancelled automatically while second one is executing but my controller receives both request and finally records getting added multiple time. I Also mapped the bootstrap plugin assets and jquery plugin asset to FALSE. I feels this is happening just because of multiple rendering but my fix was not working

How to reproduce: 1) create modal popup 2) render a pjax based form using Jquery.load(); and call $("mymodal").modal('show'); 3) close the modal popup 4) again open the same modal popup 5) now fill the form values and try to submit the form (form should be in PJAX begin and end) 6) records are adding two times. (If you open and close modal popup 3 time and at 4th records being added 4 time. Means number open calls same number of records are stored into database because same number of request are generating.

Extremely sorry for my english :) Please ignore if you found any grammatical mistakes

Thanks

ak868308 commented 7 years ago

Extremely sorry its my issue. I am using the same ID for each pjax :(

Sorry