MishkaGervaz.Form.Web.State.StepBuilder (MishkaGervaz v0.0.1-alpha.3)

Copy Markdown View Source

Builds wizard/tabs step configuration from DSL.

Steps define the multi-step form flow. Each step references groups, has optional validation actions, and lifecycle callbacks.

Overridable Functions

  • build/2 - Build steps from config and resource
  • initial_step/1 - Determine the initial step
  • initial_step_states/1 - Build initial step states map
  • step_valid?/2 - Check if a step is valid/complete

User Override

defmodule MyApp.Form.StepBuilder do
  use MishkaGervaz.Form.Web.State.StepBuilder

  def initial_step(steps) do
    # Always start at the second step
    case steps do
      [_, second | _] -> second.name
      _ -> super(steps)
    end
  end
end

See MishkaGervaz.Form.Web.State, MishkaGervaz.Form.Entities.Step, and the sibling builders FieldBuilder, GroupBuilder, Access, Presentation.