Skip to content Skip to sidebar Skip to footer

Close Fancybox Form After Symfony Validation

How to close a FancyBox containing a Symfony form after the form has been submitted ? I don't want to close the fancybox after the button is immediately clicked since the form can

Solution 1:

fancybox provides a handy beforeClose callback, you can use it to stop closing the modal, simply return false. So, if you choose to use ajax to submit and validate your form, you can display loading icon while waiting for reponse (use hideLoading for hiding):

$.fancybox.getInstance().showLoading( $.fancybox.getInstance().current );

and close on success:

$.fancybox.getInstance().close()

And for the php part I would suggest to follow dbrumann comment.

Post a Comment for "Close Fancybox Form After Symfony Validation"