Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Enhancement suggestion: isNull-validator for use in combination with applyWhen

    Hi Isomorphic,

    I have a common(?) use case (actually I had more it more than once before) where a small new feature (validator type="isNull") might help.

    A record links to one of three parent tables (id, parent1_id, parent2_id, parent3_id). Exactly one parent field must be filled.
    Now a new isNull-validator (opposite to required-validator) in combination with the new in 6.1 applyWhen could solve this.

    Code:
    <field name="parent1_id" type="integer">
      <validators>
        <validator type="[B]required[/B]">
          <applyWhen operator="[B]and[/B]">
            <criteria>
              <criterion fieldName="parent2_id" operator="[B]isNull[/B]" />
              <criterion fieldName="parent3_id" operator="[B]isNull[/B]" />
            </criteria>
          </applyWhen>
        </validator>
        <validator type="[B]isNull[/B]">
          <applyWhen operator="[B]and[/B]">
            <criteria>
              <criterion fieldName="parent2_id" operator="[B]notNull[/B]" />
              <criterion fieldName="parent3_id" operator="[B]notNull[/B]" />
            </criteria>
          </applyWhen>
        </validator>
      </validators>
    </field>
    ...
    same logic for parent2_id, parent3_id
    Best regards
    Blama

    PS:
    I wanted to look when applyWhen was added. In the 6.0(!) docs for dependentFields it is referenced by name, but not present in the docs, so there is some mismatch here.

    #2
    Hi Isomorphic,

    what do you think about this one?

    Best regards
    Blama

    Comment

    Working...
    X