Hi. I have a grid row question (Q3) with 2 numeric boxes where respondents enter a lowest price and highest price they would pay for a product.
I have a javascript validation which checks that the lowest price is not more than the highest price....
[js]
if((document.mainform["Q3_r1_c1"].value) > (document.mainform["Q3_r2_c1"].value))
{
strErrorMessage = "The Lower Price needs to be less than or equal to the Higher Price";
}[/js]
The validation works only some of the time.... After a few tests and some head scratching I came to the conclusion that the validation is only checking the first number entered into each box... For example if Low price=5 and High price=20 the error message is generated (because it only compares 5 against 2).
Does anyone know why this is happening and how to resolve it?
Many thanks for any help.
Russell
Javascript validation for comparing values in numeric text boxes
Resolved
4 replies