customvalidator using clientside script in FormView

D

Dabbler

I think my CustomValidator is failing because the client side script is not
finding the controls it refers to. The validator is supposed to insure at
least one phone number is entered. Here's my script:

function ClientValidatePhones(ctl, args)
{
var txtHPhone = document.getElementById ("tbHPhone").value;
var txtWPhone = document.getElementById ("tbWPhone").value;
var txtCellPhone = document.getElementById ("tbCellPhone").value;

if (txtHPhone.length > 0 || txtWPhone.length > 0 || txtCellPhone.length
args.IsValid = true;
}else{
args.IsValid = false;
}
}
tbHPhone, tbWPhone, tbCellPhone are textboxes inside an EditItemTemplate. Is
there another way to do this?

Thanks for any help with this.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top