Tuesday 19 May 2009

CompareValidator doesn't compare numeric amounts correctly

Well at least that is what I thought today!

I had a compare validator set on two text boxes that were used to enter monetary amounts. The validator was to ensure that box B was greater than Box A.

In this scenario, it worked:

Box A = 100, Box B = 200 = Fine

But...

Box A = 500, Box B = 1000 = Invalid

Why? Because I hadn't set the TYPE attribute of the validator to CURRENCY

D'oh!

No comments:

Post a Comment