i am having javascript function written to check if the dropdown value from an aspx page has value "Completed" or "Cancelled".if it is then check if the date and time is not null.But the function never fires. the code is below.
\[code\]function EnableValidator() { var drp = document.getElementById('<%=drpcallstatus.ClientID %>'); var txt = drp.options[drp.selectedIndex].text; var dt = document.getElementById('<%=txtcompletedate.ClientID %>'); var ct = document.getElementById('<%=txtcomptime.ClientID %>'); if ((txt == "Completed" | txt=="Cancelled") && (dt===null | ct===null)) { alert("Please Enter the Completed Date and Time"); return false; }\[/code\]The function is called from asp.net button \[code\] <asp:Button ID="btnsubmit" runat="server" Text="Submit" OnClientClick="return EnableValidator()" onclick="btnsubmit_Click" />\[/code\]
\[code\]function EnableValidator() { var drp = document.getElementById('<%=drpcallstatus.ClientID %>'); var txt = drp.options[drp.selectedIndex].text; var dt = document.getElementById('<%=txtcompletedate.ClientID %>'); var ct = document.getElementById('<%=txtcomptime.ClientID %>'); if ((txt == "Completed" | txt=="Cancelled") && (dt===null | ct===null)) { alert("Please Enter the Completed Date and Time"); return false; }\[/code\]The function is called from asp.net button \[code\] <asp:Button ID="btnsubmit" runat="server" Text="Submit" OnClientClick="return EnableValidator()" onclick="btnsubmit_Click" />\[/code\]