Enhancement
Validation across form fields
Issue description
Currently all validation that happens in the form is single field based. It should be possible to validate across fields.
Developer comments
This was implemented. There is now a [http://www.topincs.com/topincs/meta/543, compound constraint] which is composed of an _argument order_ and a _validation function_.
Use cases
If the user enters an end date before a start date a message should be displayed at both fields:
[%function (start, end) {
if (start && end && end < start) {
throw new ValidationError("End must be after start!", 1);
}
}
%]
_Conditional required_: If a certain field has a certain value, another field should become required:
[%function (flag, comment) {
if (flag === false && !comment) {
throw new ValidationError("Required!", 1);
}
}%]
If less than four pictures are attached to a report, a comment field is mandatory:
[%function (pictures, comment) {
if (pictures.length < 4 && !comment) {
throw new ValidationError("Required unless 4 pictures attached.", 1);
}
}%]
|
Work sessions6
Start |
2011-12-02T04:55:06
|
End |
2011-12-02T05:32:54
|
Participant |
Robert Cerny
|
Start |
2011-12-02T05:43:01
|
End |
2011-12-02T07:49:29
|
Participant |
Robert Cerny
|
Start |
2011-12-02T08:06:45
|
End |
2011-12-02T08:06:54
|
Participant |
Robert Cerny
|
Start |
2011-12-02T09:22:05
|
End |
2011-12-02T11:54:43
|
Participant |
Robert Cerny
|
Start |
2011-12-02T13:03:48
|
End |
2011-12-02T15:15:47
|
Participant |
Robert Cerny
|
|
We are sorry
This page cannot be displayed in your browser. Use Firefox, Opera, Safari, or Chrome instead.