Javascript confirm box, yes/no, it shows confirm box but never waits for
the use to hit Yes. it automatically submits the form
Javascript code:
if (s12.value < s10.value) {
$('<div></div>').appendTo('body')
.html('<div><h6>' + "Out Time is less than In Time. Is that
ok??" + '</h6></div>')
.dialog({
modal: true,
title: 'Confirmation',
zIndex: 10000,
autoOpen: true,
width: 'auto',
resizable: true,
buttons: {
Yes: function () {
if (s10.value < s14.value || s14.value < s12.value) {
alertDialog("Time is not between out time and
in time.");
} else {
$("#<%=Button1.ClientID%>").submit();
}
$(this).dialog("close");
},
No: function () {
$(this).dialog("close");
}
},
close: function (event, ui) {
$(this).remove();
}
});
< script >
function alertDialog(message) {
$('<div></div>').appendTo('body')
.html('<div><h6>' + message + '</h6></div>')
.dialog({
modal: true,
title: 'Errors',
zIndex: 10000,
autoOpen: true,
width: 'auto',
resizable: true,
buttons: {
Ok: function () {
$(this).dialog("close");
},
},
close: function (event, ui) {
$(this).remove();
}
});
}; < /script>
Condition 1: if (s12.value < s10.value) then display confirm box saying
"Out Time is less than In Time. Is that ok??"
if user selects Yes then Condition 2: if (s10.value < s14.value ||
s14.value < s12.value) then display alert box
else Submit the form.
Problem: It is able to show confirm box but never waits for the user to
hit Yes/No, it automatically submits the form.
Please Help. Thanks in advance.
No comments:
Post a Comment