Re: Can I tie a validator to two controls at once?
- From: Alan Silver <alan-silver@xxxxxxxxxxxx>
- Date: Mon, 21 Nov 2005 12:19:22 +0000
Nothing to stop you firing it manually. It's just javascript after all.
OK, that's certainly a help, but it would be nice if there was a way to fire the proper validation code. I presume that there must be an onchange event buried deep in the validation code that the framework provides. Why can't I just get that to fire? Or put a better way, why can't I call something in the onchange event of my dropdown that will fire the validation code with the appropriate objects passed as parameters?
One big advantage of the built-in way of doing it (as opposed to what you showed) is that you get the chance to set IsValid, which automatically sets the display of the validation summary, sets the error message next to the control (using the ErrorMessage property of the individual validator), pops up the message box and cancels the form submit. That's a lot of work done for you. Sure I could do this all myself, but it's a lot of work and is not guaranteed to work in the future. MS could easily change the way the validation works, and my page would stop working.
Thanks for the reply. Any further ideas?
<select name="drpFromYear" id="drpFromYear" onchange="runYourValidator()"> <option value="2000">2000</option> <option value="2001">2001</option> <option value="2002">2002</option> <option value="2003">2003</option> <option value="2004">2004</option> <option value="2005">2005</option>
</select>
<script>
function runYourValidator() { // validate by hand and flip the validator divs on and off as needed. }
</script>
Jason Kester Expat Software Consulting Services http://www.expatsoftware.com/
--- Get your own Travel Blog, with itinerary maps and photos! http://www.blogabond.com/
-- Alan Silver (anything added below this line is nothing to do with me) .
- References:
- Can I tie a validator to two controls at once?
- From: Alan Silver
- Re: Can I tie a validator to two controls at once?
- From: Jason Kester
- Re: Can I tie a validator to two controls at once?
- From: Alan Silver
- Re: Can I tie a validator to two controls at once?
- From: Jason Kester
- Re: Can I tie a validator to two controls at once?
- From: Alan Silver
- Re: Can I tie a validator to two controls at once?
- From: Jason Kester
- Can I tie a validator to two controls at once?
- Prev by Date: Re: How to use DataReader to retrive data from the database
- Next by Date: Re: faild to start listening port 1034
- Previous by thread: Re: Can I tie a validator to two controls at once?
- Next by thread: Q: Special server for running Cellphone apps?
- Index(es):
Relevant Pages
|