Title: Model closing too quickly
Last modified: April 18, 2023

---

# Model closing too quickly

 *  [omahadev](https://wordpress.org/support/users/omahadev/)
 * (@omahadev)
 * [3 years, 1 month ago](https://wordpress.org/support/topic/model-closing-too-quickly/)
 * We are using the modal block, with a custom element click as the trigger. Modal
   opens, and we have a Gravity Form inside.
 * If we partially submit the form, and click submit, the modal just closes, so 
   we don’t see the form errors. If we click the trigger button again to open the
   modal, we then see the errors.
 * Any way we can keep this modal open, until the form has successfully submitted?
    -  This topic was modified 3 years, 1 month ago by [omahadev](https://wordpress.org/support/users/omahadev/).
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fmodel-closing-too-quickly%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

Viewing 1 replies (of 1 total)

 *  Plugin Author [merbmerb](https://wordpress.org/support/users/merbmerb/)
 * (@merbmerb)
 * [3 years, 1 month ago](https://wordpress.org/support/topic/model-closing-too-quickly/#post-16666738)
 * In 2.1 I added custom events e.g.
 * // This is an example for the custom events, this one returns cancel=true so //
   modal will not close on the return
 * (function($){
 *  $(document).on(“bod-modal-before-close”, function(e, modalData){
 *  $(this).data(‘cancel’, true);
 *  this.$modalData = $(modalData);
 *  // alert(“added before close”);
 *  });
 * })(jQuery);
 * You can add any code you want, so you could check form was OK and if not ‘$(this).
   data(‘cancel’, true);’ so the form does not close.

Viewing 1 replies (of 1 total)

The topic ‘Model closing too quickly’ is closed to new replies.

 * ![](https://ps.w.org/modal-block/assets/icon-256x256.png?rev=2149842)
 * [Modal Guten Block](https://wordpress.org/plugins/modal-block/)
 * [Support Threads](https://wordpress.org/support/plugin/modal-block/)
 * [Active Topics](https://wordpress.org/support/plugin/modal-block/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/modal-block/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/modal-block/reviews/)

## Tags

 * [js](https://wordpress.org/support/topic-tag/js/)
 * [php](https://wordpress.org/support/topic-tag/php/)

 * 1 reply
 * 2 participants
 * Last reply from: [merbmerb](https://wordpress.org/support/users/merbmerb/)
 * Last activity: [3 years, 1 month ago](https://wordpress.org/support/topic/model-closing-too-quickly/#post-16666738)
 * Status: not resolved