Contents

Cms\Behaviors\WizardComponent

Overview

WizardComponent behavior adds multi-step form handling to CMS components.

This behavior extends FormComponent with multi-step submissions, where each step validates and saves the subset of fields carrying the posted form tag against the same record. The record is created by the first step as a partial submission and tracked in the visitor session until the final submit completes it, so a lead is captured even when later steps are abandoned. Visitors can move forward and back between steps without losing earlier input, since every step is persisted to the record.

Fields opt into wizard steps with a tags property, accepting an array or a singular string. A blueprint without tagged fields has no valid form tags and cannot be stepped through.

Components using this behavior should implement formMarkPartial and formMarkComplete so incomplete records can be distinguished, and may override formFindPartialModel to constrain how partial records resolve.

Usage in a component:

public $implement = [
    \Cms\Behaviors\WizardComponent::class,
];
Extends

Public Properties

There are no public properties in the class.

Show inherited public properties

Inherited Public Properties

Protected Properties

There are no protected properties in the class.

Show inherited protected properties

Inherited Protected Properties


Public Methods

public formFindPartialModel()

public formFindPartialModel(
    $model,
    $recordId
): October\Rain\Database\Model|null 

formFindPartialModel locates a previously deferred model by its primary key

public formGetFieldConfigByTag()

public formGetFieldConfigByTag($tag): array 

formGetFieldConfigByTag returns field configuration for fields carrying the tag, throwing an exception when the tag matches nothing to prevent a validation bypass.

public formGetFields()

public formGetFields($tag = null): array 

formGetFields returns field metadata including tags, with an optional tag argument limiting the result to fields carrying that tag.

public formGetSessionKey()

public formGetSessionKey(): string 

formGetSessionKey returns the session key used to track partial submissions

public formMarkComplete()

public formMarkComplete($model): void 

formMarkComplete clears the incomplete flag from the model before the final save

public formMarkPartial()

public formMarkPartial($model): void 

formMarkPartial flags the model as an incomplete submission before a deferred save

public formResolveDeferredModel()

public formResolveDeferredModel(): void

formResolveDeferredModel returns the partial model tracked by the session, or a newly created model when no valid partial submission exists.

public onFormGoto()

public onFormGoto(): void

onFormGoto navigates a multi-step form to the step named by _form_goto without validating or saving, displaying the already-saved values. This is the "Back" action, so the visitor never loses earlier input. An empty _form_goto returns to the first step.

public onFormStep()

public onFormStep(): void

onFormStep advances a multi-step form, validating and saving the fields of the step named by the posted _form_step value. This is the "Next" action, and the saved step becomes the active step.

public onFormSubmit()

public onFormSubmit(): void

onFormSubmit completes a deferred submission tracked by the session, or falls back to saving a new record, enforcing the full rule set.

Show inherited public methods

Inherited Public Methods

Protected Methods

protected formSaveStep()

protected formSaveStep($model, $tag): void 

formSaveStep validates the tagged fields and saves them to the partial record

Show inherited protected methods

Inherited Protected Methods