Validation problem

  • Thread starter Thread starter tshad
  • Start date Start date
T

tshad

I have been having some issues trying to get validation to work. On most of
my pages, I have no problem.

But I have a page that has 4 validation objects and none are displaying an
error message, but I have this code:

trace.warn("Before Test on Page.IsValid")
if not Page.IsValid then Exit Sub
trace.warn("After Test on Page.IsValid")

And I never get to the the 2nd trace statement.

How do I find out what it found was not valid?

Thanks,

Tom
 
Set a breakpoint and look at Page.Validators array. You'll be able to
check the IsValid property and by their error messages you can tell
which one in failing.
 
Swanand Mokashi said:
Are you calling the Page.Validate method before checking for Page.IsValid
?

No.

I never do on any of my pages.

I do have 2 ImageButtons on my screen. Both events have the same problem.

Why on my other pages does it work ok?

BTW, I did add the Page.Validate:

trace.warn("Before Test on Page.IsValid")
Page.Validate()
if not Page.IsValid then Exit Sub
trace.warn("After Test on Page.IsValid")

And it still doesn't show the 2nd trace.warn nor does it show the messages
from the Validation objects.

Thanks,

Tom
 
sam said:
Set a breakpoint and look at Page.Validators array. You'll be able to
check the IsValid property and by their error messages you can tell
which one in failing.

How would I do that using trace.warn?

I am using DW and not Visual Studio and one page not code-behind.

Thanks,

Tom
 
I found the problem, but not sure why.

I had a Validation object I had commented out, but the program was still
seeing it.

<!--
<asp:CompareValidator
ControlToValidate="WagesMin"
ControlToCompare="WagesMax"
Operator="LessThanEqual"
Type="Currency"
Display="Dynamic"
Text="<br>Minumum Wage must be less than or equal to the Maximum
Wage"
runat="server"/>
-->

I didn't realize that the ">" would stop the comment. If this is the case,
I would have assume there would be an error, or it would just show the rest
of the asp command on the output page, but it doesn't.

Why is that?

Thanks,

Tom
 
The reason I had commented it out was I could not get the Object to work.

I tried it as both LessThanEqual and GreaterThanEqual and both gave me
errors.

I have the code set as:

trace.warn("WagesMin = " & WagesMin.Text & " WagesMax = " & WagesMax.Text)
trace.warn("Before Test on Page.IsValid")
Page.Validate()
if not Page.IsValid then Exit Sub
trace.warn("After Test on Page.IsValid")

and the 1st trace gives me:

WagesMin = $150.00 WagesMax = $300.00

MS says that Currency is a decimal field with currency symbols, which I have
here.

So why doesn't it work?

Thanks,

Tom
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top