Skip to main content
Version: v1 (Current)

FormField binding and configuration

resources/js/Components/Mod/FormField.vue dispatches existing dashboard field configurations to concrete components. It is not a JSON Schema validator, and the earlier JSON schema was not enforced by this wrapper. Saved configuration, renderer props, client validation and backend request validation have separate contracts.

Use FormCard and page authoring for page/store/save setup. The field-type map lists the current dispatch spellings; a listed component does not guarantee all of its proposed features work in every context.

Context and public wrapper props​

PropCurrent contract
fieldConfiguration object; default empty object
typeFallback type, default text; a truthy field.type wins
name, label, defaultFallback values forwarded only for selected branches; default prop is declared String
dataStoreCompatible Pinia store exposing dataModel and the selected field's get/set interfaces; default null is not a usable page store
errorMessagesArray for wrapper/selected child display, default empty
columnClassOptional wrapper class override
previewModeBoolean forwarded by selected branches; not a global permission bypass or full runtime preview
inlineUses span/inline wrapper layout; does not change backend semantics
conditionDeclared wrapper Function prop; actual visibility uses the field configuration path described below

The wrapper also exposes a default model accepting string, number, Boolean, array or object, initialized to null. Concrete children may accept a narrower value shape. Its explicit emitted update event is updateValue with name, column and value.

Select and configure the renderer​

The setup-time switch selects field.type || type and records a per-branch forwarded-prop list. It is not a reactive type registry: if replacing the field with a different type, verify remount/key behavior instead of assuming the selected component and model-bridge mode are rebuilt.

Missing field.type uses the fallback text type; an unknown explicit type has no default switch branch, leaving no selected child. Some wrapper/helper/error markup may still exist. Do not use a misspelled type as a validation or visibility technique.

A field for an already configured page is:

{
"type": "text",
"name": "heading",
"column": "custom_settings",
"label": "Heading",
"required": true,
"helperText": "Shown above this experience's content",
"cols": 12,
"colsMd": 6
}

This binds the intended custom_settings.heading path through its child/store contract. It does not create the page, supply authorization or define a backend request rule. Verify save output and reload as described in page authoring.

The wrapper passes the resolved field object plus selected convenience props to the concrete child. A property missing from the convenience list can still be read through field by a child, but is not universally consumed. For example, options are not one universal array-of-label/value schema: different selectors/builders have different object/value contracts. Inspect the selected child.

Legacy writes versus model bridge​

Many legacy children write their own store values, sometimes with debounce. FormField avoids writing those again from its model handler. Model-only children can opt into the wrapper bridge, which reads an initial store value and writes changed model values through setModelValue(fieldRef, value, true).

For selectAsset/select-asset, a truthy field.assetSearchRoute selects the model-only AssetPickerFile and enables the bridge; otherwise ProjectAssetSelector is selected without that wrapper bridge.

The reviewed bridge paths include that configured asset-picker selection, API interception mapping, access-point rule conditions, token input/textarea, mapping table, cron schedule and radio list. This does not mean every visually similar field shares the same bridge or debounce behavior.

For a bridged field:

  • On mount, a nonnull store value seeds a null wrapper model. An already supplied nonnull model is not overwritten by that seed.
  • A watcher follows later external store updates. If an undo operation updates that same store value, the watcher can mirror it; this is not a rollback of a backend request or a guarantee for every child.
  • Input writes use name and optional column and mark a changed value dirty; equal-reference/value checks can avoid a repeated write.

For a legacy self-writing child, a wrapper model event or updateValue is not proof the store has already flushed its own debounce. Test immediate save, undo and empty/false/zero values through the actual child. Do not add a second generic store write to fix one field without checking duplicate updates.

Readonly, required and conditions​

Readonly presentation uses an array of readonlyConditionParams with length greater than zero first, then a functional readonly value, then its Boolean value. Functional readonly/required callbacks receive field and current data model. Required presentation evaluates the function when field.required is a function, otherwise Boolean-coerces field.required; there is no requiredConditionParams precedence in this wrapper. Nonempty readonly conditions are also resolved into the field object passed through the ordinary binding path. Special modal/table/card-list binding branches have their own return shapes; do not assume every child consumes the same flags.

readonlyTooltip is shown when readonly, with string or callback support. Required/readonly CSS and native child attributes are UI behavior, not server validation. A required marker does not prove the backend rejects missing data; readonly/disabled/hidden fields can still be changed by a caller outside the UI.

Visibility checks field.condition/conditionParams with the dashboard helper and current model, then the feature/permission presentation helper. Those helpers have their own fallback behavior; see FormCard visibility. Field-level conditions do not filter backend data or protect secret values.

JavaScript callbacks work in authored page modules. A JavaScript function written as a JSON string is not automatically compiled into a condition/hook. Use supported stored declarative shapes and verify the consuming helper instead of treating the old schema's condition-string type as executable validation.

Defaults, content and value shapes​

Several forwarded convenience values use truthy fallback, including field.default || props.default. This can discard a configured false/zero/empty value at that forwarding step. The store initializer and the concrete child may apply additional defaults differently; test stored versus missing values rather than assuming one shared default algorithm.

Display content, format, options, accept rules and limits are consumed by individual fields. The wrapper does not establish a universal date-format enum, accepted-file-type array or per-type sanitization guarantee. In particular, hidden inputs are browser-visible/editable state and do not secure IDs/tokens. A hidden field's DOM presence also does not guarantee it enters ShowPage's tracked dirty payload.

Do not store privileged server credentials in frontend field configuration. Secret/token controls have their own display/rotation contracts; a password mask or hidden type is not encryption or authorization.

Input side effects​

After any selected bridge write, onInput can perform several configured actions:

  1. query_parameter changes the browser URL query and uses Inertia visit.
  2. Functional inputHook receives router, value and dataStore.
  3. navigate can be a function receiving router/value, or an object whose route value is visited.
  4. updateValue is emitted as {name, column, value}.
  5. refresh.only can trigger an Inertia GET to the current page URL with the value under refresh.key and a partial-props list.

These options can combine and cause more than one navigation/request. They do not automatically debounce, serialize, await or roll back each other. A thrown hook can stop subsequent steps. Validate exact route/value/query behavior and request/error state before using them on a frequently updated input. A changed URL is not a saved record.

Special binding paths​

  • form-modal maps its modal/button/tab options separately and exposes an openModal() wrapper method only for that selected type. Confirm the child exists before using it.
  • data_table / data-table returns the table's own title/list/header/options/create binding shape; it is not the same prop structure as a text field.
  • card-list builds a FormPanel tab from configured cards or a resolved list.
  • component selects the configured Vue component and merges componentProps into bindings. It does not import arbitrary component code or forward every possible custom event.
  • snippet resolves a config fragment through the page snippet store and recursively renders the resolved field. A missing resolution yields no ordinary field body in that branch.

Use the owning field/table/modal/builder guide for its detailed behavior. Frontend component registration does not certify resource binding or endpoint access.

Layout and diagnostics​

cols starts at 12 and responsive values cascade via truthy fallback through colsSm/Md/Lg/Xl. Zero does not create a zero-width column. columnClass can override the field's columnClass; inline mode changes the wrapper class/element. Helper text and wrapper errors are rendered separately from child-specific messages.

SymptomInspect
Field absentExact type, setup/remount behavior, conditions, UI permission helper and snippet resolution
Value changes but save misses itLegacy self-write versus model bridge, name/column, debounce flush, dirty paths and backend schema
Undo does not update fieldActual bridged watcher/legacy child synchronization, not merely emitted updateValue
False/zero/default behaves unexpectedlyStore initialization, wrapper truthy forwarding and child default rules
Required/readonly UI differs from serverActual child attributes and separate request validation/policy
Typing navigates repeatedlyCombined query_parameter/inputHook/navigate/refresh side effects
Stored callback string has no effectAuthored JavaScript versus stored declarative configuration

Verify the actual selected field with representative values, immediate save, undo, route failures, allowed/denied principals and reload. Existing wrapper tests cover particular branches; they do not certify every registered field or backend operation. Keep detailed operational recovery in separate runbooks.