bri189a Posted December 10, 2005 Posted December 10, 2005 I usually stay away from this one because I can get most to work with a regular expression validator. Anyway, what I have is a ListBox (<select>), and I want to ensure an item is selected prior to the form being submitted. It appears through my testing that the client side script doesn't fire when I submit the form unless I first select an item in the list box (which would take the point out of ensuring an item is selected). Furthermore, as a back-up I set the Server_OnValidate method to do a similiar check...it never fires, even when I expressly call Page.Validate(), or for that matter event the Validate method of the custom validator. I haven't ever seen these issues with any of the other validators, since I usually don't mess with this particular validator I figure I must be missing something. Any thoughts would be appreciated. Quote
hsueh001 Posted December 12, 2005 Posted December 12, 2005 In your "Accept" button event are you doing a check on If Page.IsValid then ... continue Else ... End If For some reason the custom validators seem to need this. I don't know if there's a way to associate the validator to the SelectedIndexChanged event. I've had to place it in the button I use to determine acceptance of the page. I usually stay away from this one because I can get most to work with a regular expression validator. Anyway, what I have is a ListBox (<select>), and I want to ensure an item is selected prior to the form being submitted. It appears through my testing that the client side script doesn't fire when I submit the form unless I first select an item in the list box (which would take the point out of ensuring an item is selected). Furthermore, as a back-up I set the Server_OnValidate method to do a similiar check...it never fires, even when I expressly call Page.Validate(), or for that matter event the Validate method of the custom validator. I haven't ever seen these issues with any of the other validators, since I usually don't mess with this particular validator I figure I must be missing something. Any thoughts would be appreciated. Quote
bri189a Posted December 12, 2005 Author Posted December 12, 2005 Yes that check is there and even put Page.Validate() before it just to hopefully get it to fire, but it never does. Think I'll do the same thing you did, handle the check in my own script. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.