View Single Post
  #1 (permalink)  
Old December 18th, 2008, 04:54 AM
sim sim is offline
Registered User
 
Join Date: Dec 2008
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default return value of Confirm in javascript not Working onClientClick

return value of Confirm in javascript not Working OnClientClick of button.
button is placed in updatePanel (AJAX).
JavaScript code for confirm is also in updatePanel(AJAX)

Code:
 
function chkleave()
{
var dat1 = document.getElementById("txttxtleavestartdate").value;
if (dat1.length != 10) 
{
returntrue;
}
var dat2 = document.getElementById("txttxtleaveenddate").value;
if (dat2.length != 10) 
{
returntrue;
}
if(Math.floor((new Date(dat2)-new
Date(dat1))/(1000*60*60*24))>document.getElementById("lblpendingleaves").innerHTML)
{
if (!confirm("Your Leave days are exceeding pending leaves. \n Your extra leaves will be considered 'Leave Without Pay'. \n Are you sure you want to send it for approval."))
return false;
}
}
 
<asp:ButtonID="btnSubmit"OnClientClick="return chkleave()"ValidationGroup="vali"CssClass="txtBox"BackColor="#1B3091"Font-Bold="True"ForeColor="White"runat="server"Text="Submit"OnClick="btnSubmit_Click"/>

Last edited by sim; December 19th, 2008 at 02:26 AM.. Reason: made changes after response but still not working
Reply With Quote