If present subform
Show one sub-form when an earlier field holds a value, with that field required inside it, and another sub-form otherwise
Ingredient Family: formIngredients
Outline Display: A sub-form shown when {{column}} is present: {{subFormT}}Otherwise: {{subFormF}}
Details
Inside subFormT the chosen field is required, so a step there may hand it to an input that needs it (a file upload, a key) without COALESCE; subFormF sees it optional, as every later field does. The field’s current value chooses both the branch shown and the branch committed. While a branch is hidden its view of the field is the type’s placeholder, and nothing runs on it.
Local scope
The parent slot binds these (look up the slot in the parent to see how):
$parentTable– The table (if any) that this form is based on$formFieldsTable– A table of form fields that is built up through the sequence of form ingredients
Names introduced within this component’s knobs:
$formFieldsTable/present– empty table populated by ingredients
Settings
Required
column: column of$formFieldsTable(type filter: any type (must be optional))
The earlier field whose presence chooses the sub-form
Optional
-
subFormT: ingredient slot offormIngredients($parentTable, $formFieldsTable/present)(many)
The sub-form to show when the field holds a value; it sees the field as required -
subFormF: ingredient slot offormIngredients($parentTable, $formFieldsTable)(many)
The sub-form to show when the field is empty