client side validation trouble

  • Thread starter Thread starter DaveyP
  • Start date Start date
D

DaveyP

Ok.

I have a page with a textbox which is used to enter numeric data. If
data is entered, the code goes to the database and gets the relevant
data. If it's left blank, the code assumes that new data is being
entered and allocates a number.

The problem is that the client side validation (custom validator with
Jscript to check for numeric input) on the text box is firing twice.

Any ideas?

Ta.
 
Ok, sort of figured it.

The textbox has autopostback = true, cos it needs to get the relevant
data (if not invalid). Unless I'm wring (which in reality is most
likely), it's running the code once for the "lost focus" and once for
the postback.

If I'm right, how do I stop one of them?
 
you can't, it by design. the validation is called on lost focus, and on a
validated submit. your validation shoudl support running mutilple times.

-- bruce (sqlwork.com)
 
Back
Top