Skip to content

feat: implement remaining conditional logic operators in server-side validation #77

@harshtandiya

Description

@harshtandiya

Context

_evaluate_conditions in forms_pro/api/submission.py currently handles only 4 of the 15 operators defined in the frontend ConditionalOperators enum:

Implemented Not implemented
Is Contains
Is Not Does Not Contain
Is Empty Is Less Than
Is Not Empty Is Less Than Or Equal To
Is Greater Than
Is Greater Than Or Equal To
Starts With
Does Not Start With
Ends With
Does Not End With
Is Set

Current behaviour

An unsupported operator silently passes (the condition evaluates to True), so a form with a Contains condition will behave as if the condition is always met. This can cause fields to be incorrectly required or visible.

Fix

Implement the missing operators in _evaluate_conditions, mirroring the logic in frontend/src/utils/conditionals.ts. The frontend implementation is the reference — the backend must produce identical results for all operators so that direct API calls cannot bypass frontend validation.

Add tests for each new operator.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions