Skip to Content
Jan 29, 2009 at 05:10 PM

javascript validations based on several table rows



I've got an interactive offline form with javascript (without web dynpro), with a button which allows the user to add dynamically rows to a table. There is a validation on field "Valid from" that checks the row does not overlap validity dates of existing rows with the same characteristic. In that case, an error message has been defined in the script message field (and "error" checkbox is checked). Note that when "Valid to" is null, it is processed as if it were 9999-12-31.

Characteristic  Valid from  Valid to    Value
--------------  ----------  ----------  ------
CharacName1     2009-01-01  2009-01-31  100
CharacName2     2008-01-01  9999-12-31  80
CharacName1                                 <-- dynamically added line, its
                                                validity dates overlap line 1

When I add the row (line 3) and enter CharacName1 in the characteristic field, the validation script is automatically called on "Valid from" field which returns false (I can check it by debug), but it doesn't display the error message as it should do. Same thing for "Valid to" field.

When I change "Valid from" to 2009-01-01, the validate script returns false and the error message is displayed.

How should I do to display the error message, whatever I change Characteristic, Valid from, or Valid to ?