P
philjohn
Hi there,
I'm attempting to create my own Validation Web Server controls to
perform 2 different field checks:
* Number of words
* Number of letters
I've followed most of the tutorials out there on the subject and keep
running into a brick wall with ASP.NET 2.0 - the client side validation
code isn't being run.
The problem is, all of the tutorials out there have said to put the
following in AddAttributesToRender
writer.AddAttribute("evaluationfunction",
"TextBoxLengthValidatorIsValid");
writer.AddAttribute("maximumlength", this.MaximumLength.ToString());
When I fire up the page in a browser, however, what this has done is
add attributes to the span that serves as the validator text holder.
All ASP.NET 2.0 validators output their attributes in a block of
JavaScript that looks like this:
var ctl00_ContentMain_BrochureRepeater_ctl00_TitleValidator =
document.all ?
document.all["ctl00_ContentMain_BrochureRepeater_ctl00_TitleValidator"]
:
document.getElementById("ctl00_ContentMain_BrochureRepeater_ctl00_TitleValidator");
ctl00_ContentMain_BrochureRepeater_ctl00_TitleValidator.controltovalidate
= "ctl00_ContentMain_BrochureRepeater_ctl00_Title";
ctl00_ContentMain_BrochureRepeater_ctl00_TitleValidator.errormessage =
"Title is a required field";
ctl00_ContentMain_BrochureRepeater_ctl00_TitleValidator.validationGroup
= "BrochureGroup";
ctl00_ContentMain_BrochureRepeater_ctl00_TitleValidator.evaluationfunction
= "RequiredFieldValidatorEvaluateIsValid";
ctl00_ContentMain_BrochureRepeater_ctl00_TitleValidator.initialvalue =
"";
I've searched high and low and can find no way of setting the
"evaluationfunction" property that is output here, does anybody have
any ideas, I could really use some about now!
Thanks in advance for any help you ASP.NET gurus can give,
Phil.
I'm attempting to create my own Validation Web Server controls to
perform 2 different field checks:
* Number of words
* Number of letters
I've followed most of the tutorials out there on the subject and keep
running into a brick wall with ASP.NET 2.0 - the client side validation
code isn't being run.
The problem is, all of the tutorials out there have said to put the
following in AddAttributesToRender
writer.AddAttribute("evaluationfunction",
"TextBoxLengthValidatorIsValid");
writer.AddAttribute("maximumlength", this.MaximumLength.ToString());
When I fire up the page in a browser, however, what this has done is
add attributes to the span that serves as the validator text holder.
All ASP.NET 2.0 validators output their attributes in a block of
JavaScript that looks like this:
var ctl00_ContentMain_BrochureRepeater_ctl00_TitleValidator =
document.all ?
document.all["ctl00_ContentMain_BrochureRepeater_ctl00_TitleValidator"]
:
document.getElementById("ctl00_ContentMain_BrochureRepeater_ctl00_TitleValidator");
ctl00_ContentMain_BrochureRepeater_ctl00_TitleValidator.controltovalidate
= "ctl00_ContentMain_BrochureRepeater_ctl00_Title";
ctl00_ContentMain_BrochureRepeater_ctl00_TitleValidator.errormessage =
"Title is a required field";
ctl00_ContentMain_BrochureRepeater_ctl00_TitleValidator.validationGroup
= "BrochureGroup";
ctl00_ContentMain_BrochureRepeater_ctl00_TitleValidator.evaluationfunction
= "RequiredFieldValidatorEvaluateIsValid";
ctl00_ContentMain_BrochureRepeater_ctl00_TitleValidator.initialvalue =
"";
I've searched high and low and can find no way of setting the
"evaluationfunction" property that is output here, does anybody have
any ideas, I could really use some about now!
Thanks in advance for any help you ASP.NET gurus can give,
Phil.