I have three identical SelectField
inputs in a form, each with the same set of options. I can't use one multiple select.
I want to make sure that the user selects three different choices for these three fields.
In custom validation, it appears that you can only reference one field at a time, not compare the value of this field to others. How can I do that? Thanks!
Use FieldList like this:
You can have validators on Field level AND on FieldList level
You can override
validate
in yourForm
...I wrote a small python library required to make cross-field validation like this easier. You can encode your validation logic declaratively as pairwise dependencies. So your form may look like:
You can take the VALIDATION object and append more validation rules or even put it in a separate module and import / reuse validation rules in different places.