The Bull Og

Onine since 1994. Offline since 1976.

See also the archive

An individual post follows.

To do some validation on two dates (an end date and a start date where the end date shouldn't be earlier than the start date,) I tried making use of the CompareValidator. After much frustration, I finally got rid of it and coded the JavaScript for the validation myself. I was making use of a CompareValidator control in a webform along with a hyperlink-as-submit-button ala this tutorial. When I tested the hyperlink, I got this:
'event' is null or not an object
When I tried this...
I got this in the popup...
function anonymous() {
               return false;
...which seemed to indicate that the onsubmit event is hooked into the .NET web validation javascript via a pointer somewhere. What to do? How about including an invisbile submit button to force the form submission (thank you W3Schools!) ala:
The problem I ran into was that I couldn't test whether the technique returned true (validation OK) or false (try again) which was necessary before submitting the values to commit to the database. In the end, I wound up including my own JavaScript to validate the dates. No post backs, just simple validation client-side.