Click here to Skip to main content
15,901,373 members
Home / Discussions / JavaScript
   

JavaScript

 
QuestionTransforming a table to node diagram Pin
info_hacker8-Dec-11 21:12
info_hacker8-Dec-11 21:12 
QuestionUsing Javascript to list local directory contents Pin
Member 84548754-Dec-11 8:15
Member 84548754-Dec-11 8:15 
AnswerRe: Using Javascript to list local directory contents Pin
Wonde Tadesse5-Dec-11 4:36
professionalWonde Tadesse5-Dec-11 4:36 
QuestionJavascript code to fetch data from an excel file and upload data to an ftp site Pin
zone132-Dec-11 11:15
zone132-Dec-11 11:15 
AnswerRe: Javascript code to fetch data from an excel file and upload data to an ftp site Pin
twseitex3-Dec-11 5:59
twseitex3-Dec-11 5:59 
QuestionDrag & Drop jQuery to table rows and update database? Pin
btvbill30-Nov-11 10:28
btvbill30-Nov-11 10:28 
AnswerRe: Drag & Drop jQuery to table rows and update database? Pin
Dennis E White1-Dec-11 7:14
professionalDennis E White1-Dec-11 7:14 
QuestionJavascript / JQuery pop-up message question Pin
AeonBlue30-Nov-11 4:59
AeonBlue30-Nov-11 4:59 
System:
Visual Studio 2010
.Net 4.0
JQuery 1.4.2

I will start this off with a caveat that I am by no-means a javascript guy and am pretty new to JQuery.

I'm writing a page that has a several-step process to scheduling an appointment. We are accomplishing this using a multi-view control to navigate through the several step process.

Like any good user-friendly site, I have set up a pop-up message in javascript that alerts the user if they try to navigate away from the page or refresh the page, close their browser, etc. before they finish scheduling their appointment that they will lose any unsaved data (much like the person who posted just before myself).

To get around the navigation buttons for the multiview triggering the onbeforeunload event, I use the following, triggered by the onClientClick event of the buttons:

JavaScript
<script type="text/javascript">
    LinkBit = true;

    window.onbeforeunload = function () {

        if (LinkBit) {
            return "Leaving this page will cause all unsaved data to be lost";
        }

        LinkBit = true;
    }

    function TurnOffMessage() {
        LinkBit = false;
    }
</script>


The next problem we ran into is that one of our controls within the multiview, an ASP:Calendar was triggering the onbeforeunload event, causing the popup to occur when the user was trying to select a date.

To get around this we used the following JQuery within the control with the calendar wrapped in a div tag with the ID of "calendar":

ASP.NET
<div id="calendar">
<asp:Calendar ID="CalendarforAppointments" runat="server" miscStyling/Events>
</asp:Calendar>
</div>


JavaScript
<script type="text/jscript">
             $("#calendar a").bind('click', function () {
                 TurnOffMessage(); 
                 return true;
             });
</script>


This solution is dangerously close to solving my problem. My issue that I'm coming to you all for help is that the above JQuery does not affect the month navigation on the calendar control so the popup still pops-up when the user tries to change which month they're viewing.

If I use the above on the main page and wrap the control in the same div it ends up killing all pop-up functionality.

I appreciate any help you all can provide.
"The shortest distance between two points is under construction"
-Noelie Altito

AnswerRe: Javascript / JQuery pop-up message question Pin
Not Active30-Nov-11 6:05
mentorNot Active30-Nov-11 6:05 
AnswerRe: Javascript / JQuery pop-up message question Pin
Dennis E White30-Nov-11 7:29
professionalDennis E White30-Nov-11 7:29 
GeneralRe: Javascript / JQuery pop-up message question Pin
AeonBlue30-Nov-11 8:52
AeonBlue30-Nov-11 8:52 
GeneralRe: Javascript / JQuery pop-up message question Pin
Dennis E White30-Nov-11 11:13
professionalDennis E White30-Nov-11 11:13 
QuestionConfirm dialog with OK ,CANCEL buttons on window close Pin
siva45524-Nov-11 20:20
siva45524-Nov-11 20:20 
AnswerRe: Confirm dialog with OK ,CANCEL buttons on window close Pin
phome25-Nov-11 23:08
phome25-Nov-11 23:08 
GeneralRe: Confirm dialog with OK ,CANCEL buttons on window close Pin
Shameel26-Dec-11 4:02
professionalShameel26-Dec-11 4:02 
Questionenable check box not working Pin
byka22-Nov-11 9:20
byka22-Nov-11 9:20 
AnswerRe: enable check box not working Pin
Richard MacCutchan22-Nov-11 9:30
mveRichard MacCutchan22-Nov-11 9:30 
GeneralRe: enable check box not working Pin
byka22-Nov-11 9:35
byka22-Nov-11 9:35 
GeneralRe: enable check box not working Pin
Richard MacCutchan22-Nov-11 9:54
mveRichard MacCutchan22-Nov-11 9:54 
QuestionRe: enable check box not working Pin
DaveAuld22-Nov-11 9:46
professionalDaveAuld22-Nov-11 9:46 
AnswerRe: enable check box not working Pin
byka22-Nov-11 9:49
byka22-Nov-11 9:49 
AnswerRe: enable check box not working Pin
Satheesh154622-Nov-11 16:47
Satheesh154622-Nov-11 16:47 
GeneralRe: enable check box not working Pin
byka23-Nov-11 2:15
byka23-Nov-11 2:15 
AnswerRe: enable check box not working Pin
phome26-Nov-11 14:04
phome26-Nov-11 14:04 
QuestionHelp with Javascript Code Pin
ThianBrodie12-Nov-11 19:05
ThianBrodie12-Nov-11 19:05 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.