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

  • SEARCH
  • Home
  • 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 7952955
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T03:01:07+00:00 2026-06-04T03:01:07+00:00

I have a checkbox bound to an observable on a view model. I have

  • 0

I have a checkbox bound to an observable on a view model. I have a requirement to essentially pop up an “Are you sure?” confirmation prompt if the user changes it from true to false. I’m having a horrible time figuring out the best place to make the change “cancelable” . . .

1) jQuery handler for click event
2) Viewmodel internal subscribe “beforeChange”
3) Viewmodel internal subscribe (normal)

In any case, I’d vastly prefer to have the chance to cancel the change outright than react to the change, potentially reverting it back to its previous value if need be.

Does Knockout’s subscribe event give you the chance to cancel a change? Any insight would be appreciated. Thanks!

  • 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-06-04T03:01:08+00:00Added an answer on June 4, 2026 at 3:01 am

    Here is a simple option using jQuery’s stopImmediatePropagation:

    http://jsfiddle.net/rniemeyer/cBvXM/

    <input type="checkbox" data-bind="click: confirmCheck, checked: myvalue" />
    

    js:

    var viewModel = {
        myvalue: ko.observable(false),
        confirmCheck: function(data, event) {
            if (!confirm("Are you sure?")) {
                event.stopImmediatePropagation();            
                return false;
            }
            return true;
        }
    };
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a datagrid bound to a CollectionViewSource view in my view model. The
I have a checkbox list of sports which is bound to an observable collection
I have Listbox which is bound to my view model. This view model has
I have a checkbox who's checked value is bound to a binding source which
In my WPF application I have a CheckBox whose IsChecked value is bound to
I have a ListView with a CheckBox as one of the columns, bound to
I have added checkbox selection model to grid panel. It works fine in IE8
I have an NSOutlineView with checkboxes. I have the checkbox state bound to a
I have a grid view that is data bound to a dataset. In a
I have a checkbox column bound to a dependency property. When editing the checked

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.