In my ASP.NET page using the following code:
<asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
<script type="text/javascript" language="javascript">
function ValMail() {
var txt = document.getElementById("<%= Email.ClientID%>");
var Resp = <%IsValidEmail(Email.Text)%>;
if (Resp != false)
txt.nodeValue = "";
txt.focus();
};
</script>
<asp:Label ID="EmailLabel" runat="server" AssociatedControlID="Email">E-mail:</asp:Label>
<asp:TextBox ID="Email" runat="server" TabIndex="4" CssClass="textEntry" CausesValidation="True" ></asp:TextBox>
<asp:Button ID="TestButton" runat="server" OnClientClick="ValMail()" />
My problem is that when I click on the button comes to executes the command OnClientClick="ValMail()"
Holds the execution of the program and throw me an error javascript runtime error: ValMail() is undefined
But even sow I'm clicking Ignore and the code goes into the script executes only the line var Resp = <%IsValidEmail(Email.Text)%>; and nothing from the rest of the code in javascript
I’m completely unfamiliar with javascript coding and most with the thrown errors. Is someone to assist me with that?
IsValidEmail(Email.Text)returns a string, that string needs quoting for javascript variable. As @plalx mentioned...need code browser sees to debug. How it gets generated is irrelevantIsValidEmail? Is it on the code behind?trueandfalseare case sensitive and are lowercase