Yii, ajax, Button. How to prevent multiple JS onclick bindings -


(first of english not native language, i'm sorry if i'll mistaken). i've created yii web app input form on main page appears after button click through ajax request. there "cancel" button on form makes div form invisible. if click "show form" , "cancel" n times , submit form data request repeating n times. obviously, browser binds onclick event submit button every time form appears. can explain how prevent it? thank you!

i've had exact same problem , there discussion in yii forum.

this happens because returning ajax results "render()" instead or renderpartial(). adds javascript code every time activate ajax buttons. if active triggered twice. solution use renderpartial(). either use render first time , renderpartial(), or use renderpartial() start make sure "processoutput" parameter set true first time.


Comments

Popular posts from this blog

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -