Skip to Content

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 ?


Add a comment
10|10000 characters needed characters exceeded

Related questions

1 Answer

  • Posted on Aug 25, 2009 at 03:14 PM

    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.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.