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;
}
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;
}