Skip to content

B3: dynamic field options / cascading selects (optionsWhen) — CEL, dual-side #1583

@xuyushun441-sys

Description

@xuyushun441-sys

Context

Follow-on to B2 (conditional rules). A very common enterprise-form need: a select/lookup whose available options depend on another field — e.g. pick a Country, then State only lists that country's states; or Status filters the allowed next-Status set.

Goal

A CEL-driven option filter, same dual-side philosophy as B2 (client UX + server enforcement, one dialect):

  • Spec: add an optionsWhen / option-filter predicate to the field schema (framework @objectstack/spec).
  • Client (objectui): the select/lookup widget re-evaluates the option set reactively against the live record (reuse @objectstack/formula via the evalFieldPredicate path).
  • Server: enforce that a submitted value is within the allowed set (reject otherwise), so the client filter isn't bypassable.

Cross-repo

  • framework: spec prop + server-side validation (@objectstack/objectql rule path, alongside requiredWhen/readonlyWhen).
  • objectui: select/lookup widget filtering + ObjectForm/grid passthrough.

Open questions

  • Static option list filtering vs. lookup (query-backed) filtering — likely both, but lookup needs the predicate folded into the query filter.
  • Authoring shape: predicate over record.* returning the allowed value set, vs. a per-option visibleWhen.

Acceptance

  • Showcase demo: a cascading pair (e.g. category → subcategory) where changing the parent re-filters the child options live.
  • Server rejects an out-of-set value.
  • Live e2e + ADR.

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