Ok so this is driving me insane right now.
I am currently on page 313 at the How It Works and mine is not working like the book says it should.
When I leave all fields blank and click Send I get the popup with the information to:
Enter Name
Enter an e-mail address
Confirm e-mail address
Enter a comment
I do not get the message to Enter a home or business phone number.
I only get an error on this if all other fields are filled in correctly and submitted and then I only get the *.
I have compared my code to the downloaded code and checked all spelling and capitalization and just can not figure it out. Below I will submit my code snippets for review. Thank you for your time!
javascript:
Code:
<script type="text/javascript">
function ValidatePhoneNumbers(source, args)
{
var phoneHome = document.getElementById('<%= PhoneHome.ClientID %>');
var phoneBusiness = document.getElementById('<%= PhoneBusiness.ClientID %>');
if (phoneHome.value != '' || phoneBusiness != '')
{
args.IsValid = true;
}
else
{
args.IsValid = false;
}
}
</script>
Code Behind:
Code:
protected void CustomValidator1_ServerValidate(object source, ServerValidateEventArgs args)
{
if (!string.IsNullOrEmpty(PhoneHome.Text) || !string.IsNullOrEmpty(PhoneBusiness.Text))
{
args.IsValid = true;
}
else
{
args.IsValid = false;
}
}
Source from Table:
Code:
<asp:CustomValidator ID="CustomValidator1" runat="server"
ClientValidationFunction="ValidatePhoneNumbers" CssClass="ErrorMessage"
Display="Dynamic" ErrorMessage="Enter your home or business phone number"
onservervalidate="CustomValidator1_ServerValidate">*</asp:CustomValidator>