Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5959459
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T18:41:15+00:00 2026-05-22T18:41:15+00:00

In a basic SimpleModal implementation, I use the onClose option to check for a

  • 0

In a basic SimpleModal implementation, I use the onClose option to check for a dirty form state and prevent closing:

.. 
    function onModalClose() {
       if (this.dirty && 
             !confirm('You have unsaved changes, continue anyway?')) {
           return;
       } 
       this.dirty=false;
       $.modal.close();
    }
..

Problem is if the user cancels the close operation, the default Close control on the dialog no longer works. $.modal.close() still works.

I am sure I can get around this by not using the default button, or doing something like actively re-binding my own close function to it, but this seems strange, and I wonder if there is some easy solution I’m overlooking.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T18:41:16+00:00Added an answer on May 22, 2026 at 6:41 pm

    It’s a bit of a hack but I had success with the following code. (Note: I defined the onClose function, so this points to the modal dialog.)

     onClose: function () {
         if (this.dirty &&
                !confirm('You have unsaved changes, continue anyway?')) {
             this.bindEvents();
             this.occb = false;
             return;
         }
         $.modal.close();
      }  
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Basic question; I have this code: var partipiansRow = '<div class=form-row ><input type=text id=name
The basic problem is like this: A subscriber has successfully replicated a row from
The basic idea behind a Cancel button is to enable closing your window with
I would like to execute a function when Simplemodal opens a window, and have
Very basic, but didn't know what this type of query is called...I want a
Basic idea of my if else statements is this: If .wrap is parent element:
I understand the basic bind syntax for Option with functional java as Option.some(2).bind(new F<Integer,Option<Integer>>(){
Basic requests are: human readable / text format (for easy version control) online (for
Basic question : How to I create a bidirectional one-to-many map in Fluent NHibernate?
Basic premise: I have a Room which publishes an event when an Avatar enters

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.