In order to display my label when a user leaves out a field before clicking the button, I have set up this code. However, nothing happens when I click the button. What am I missing?
<asp:Label ID="lblError" runat="server"
Text="* Please complete all mandatory fields" style="display: none;" >
</asp:Label>
When the button is clicked, this function is called:
function valSubmit(){
varName = document.form1.txtName.value;
varSurname = document.form1.txtSurname.value;
if (varName == "" || varSurname == "")
{
document.getElementById('lblError').style.display = 'inherit';
}
else
{
.................other code goes here...........................
return true;
}
}