|
Subject:
|
Validation is not triggering
|
|
Posted By:
|
bmains
|
Post Date:
|
2/11/2004 9:28:04 AM
|
Hello,
I have a form that supports 2 "modes". I have a form with a set of labels and a set of textboxes. When the user views an item, the labels are present, and when the new button is hit, the textboxes are shown. I have custom validators and required field validators set up for some of these textboxes. At first, I thought that it may be that the validators weren't visible, which wouldn't cause them to fire, but that isn't the case (I checked it out).
They aren't triggering on the code in the add button:
Page.Validate
if ( not Page.IsValid ) then exit sub end if
I had breakpoints on the code, and it never fired. What could this be from? Is there something in the page that is making them not validate? Can I trigger each validation manually per validation control?
Any help would be appreciated.
Thanks,
Brian Mains
|
|
Reply By:
|
stu9820
|
Reply Date:
|
2/11/2004 9:43:50 AM
|
Once you click the button it posts back and I would imagine that you need to account for this. You can try something like this:
If ispostback then if page.isvalid then
*not tested and it doesn't come with a warranty

|
|
Reply By:
|
bmains
|
Reply Date:
|
2/11/2004 1:23:43 PM
|
This code only executes when I click the add button, and I turned CausesValidation off on all my buttons, so the validation doesn't get triggered incorrectly.
|