Client Side Validation in a nested user control

K

kurtzilla

I am having a problem getting my client side validation function to
work properly.

The container page has a validation summary and several text boxes to
capture user input such as firat and last names, address, etc. It also
contains a user control which handles 4 textboxes used to capture the
phone number only (the 4th is for an extension). This user control has
a custom validator which checks for valid input.

When the phone control is the only control that will not validate - it
fills in the validation summary correctly, as well as displaying the
text value (in this case an asterik) correctly.
However, when a control on the container page is invalid and the phone
control is invalid, only the error message for the container page's
control shows up in the summary. The text value for the user control
shows up, but the error message is not displayed.

What about the nesting is keeping the summary from showing both
messages?

I realize I may have left out some pertinent details - but just hoping
someone has run into this problem before. Please feel free to ask for
whatever info may help.

Here is the client validator function:
(the getElementByLikeId function is similar to getElementById but gets
around the problem of nested control names such as
"ctl0__ctl0__TextInputControl")

function ValidatePhoneDisplayControl(source, args) {

if((args.Value.length < 4) ||
(getElementByLikeId(source.document.forms[0],
"TextPhone2").value.length < 3) ||
(getElementByLikeId(source.document.forms[0],
"TextPhone1").value.length < 3)) {

args.IsValid = false;
}

args.IsValid = true;
}
 

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

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,053
Latest member
BrodieSola

Latest Threads

Top