cancel
Showing results for 
Search instead for 
Did you mean: 

javascript validations based on several table rows

Sandra_Rossi
Active Contributor
0 Kudos

Hello,

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 ?

Thx

Accepted Solutions (1)

Accepted Solutions (1)

Sandra_Rossi
Active Contributor
0 Kudos

Solution : when you have a validation which applies to several fields at the same time, you must not use the "script message" field. Instead use a global function that checks everything, and which is called when any field is changed. I couldn't find a better solution.

Answers (0)