Our apps are required to "monitor" changes that a user makes to a form. For example, if a user changes the value of a dropdown box and tries to navigate away from the page, the app will warn the user -- using a Javascript dialog box -- that any unsaved changes will be lost if he navigates away from the page, unless he clicks the cancel button that appears on the Javascript dialog box. My questions is: Is there an easy way to monitor changes made to a Web Date Chooser object? Currently, I am using an <asp:textbox> control to monitor changes. Its value is set to an empty string, and its value changes when the user selects/clears a date value (this is handled in the web date chooser's _ValueChanged method). When that textbox value changes, the app will warn the user about losing unsaved changes if he tries to navigate away from the page. While this approach works fine, I'd prefer to monitor changes without the addition of a textbox control. Has anyone succeeded in doing so?
If you've got this notification working with a textbox, you're most of the way there.
You can declare a JavaScript variable in the head of your page, after which you can manipulate or check the value of that variable in the same way you're currently using the textbox.
I am also implementing logic to warn a user about navigating away from a web page if they have made changes. I'm using a lot of JavaScript for this. When the user makes a change, I set a variable "hasChanged" equal to True. This way the user is only warned if they have actually made a change. I do this in the onClick event for checkboxes and radiobuttons, the onChange event for dropdownlists, and the onKeyDown event for textboxes. I cannot seem to find the javascript event which is triggered when the user selects a new date in the webdatechooser or the webcalendar (I need to track changes to both).
Any thoughts?