Odd validation problem

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have an odd problem with validation and I'm not sure if the problem's in
ASP, VB, Javascript, or a third-party component.

We created a user control (ASP1.1) that encapsulates a third party control
(a Telerik RadComboBox). It's really just a Yes/No option box. However due
to the Look & Feel of our application, the powers-that-be have decided that
it is necessary to allow text entry rather than making it mouse-selectable
only.

The problem is this. I added a custom validator to the control which calls
a javascript function within the control. The script simply compares the
current text with the possible selections in the list and returns false if
the text is not exactly one of the valid selections.

I had 3 of these controls on one screen and when I entered a partial
(incorrect) string in the last of the 3 controls, the validators for all
three fired. It seems that any one of these will set off all those above it.
 
It sounds like the ControlToValidate property on all three CustomValidators
points to that 3rd control. Here's why. You are saying that all three fire
after an edit is made (not on submit). The ControlToValidate property hooks
up the "onchange" event handler to the control identified. It sounds like 3
validators all have their onchange event handler pointing to the same
control.

Now if this is only happening on submit, I would look for a hardcoded id
value in the javascript function. That id is pointing to the 3rd control.
Your function needs to be flexible enough to get values from any combobox by
getting the id through some other technique.

--- Peter Blum
www.PeterBlum.com
Email: (e-mail address removed)
Creator of "Professional Validation And More" at
http://www.peterblum.com/vam/home.aspx
 
For now let me say that when I looked at the source of the returned page, it
looked like each validator was pointing to it's own instance. But then again
it could be a third party problem, since, strictly speaking, it was not
exactly an onChange event but a proprietary 'OnClientDropDownClosing' event.

Also, in case I was not clear enough, the custom validator (and the
Javascript) were a part of the User Control, not independent objects, so one
would expect them to point to their own instance of the dropdown.

I'm going to try this again when I have time. For now there's no time.

Thanks.
 

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

Back
Top