Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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.

Posted

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.

Posted
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.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...