A state machine to handle forms in elm.
The form machine can have 5 states.
Events to move the machine from one state to another
Custom handlers for the machine. Read transition.
Perform a transition with the given configuration, event and current state.
If it's impossible to handle such event for the current state, the badTransition function is called, for example to log it to your error monitoring platform.
The update function will update one specific field of the object, for example after the user typed into the related input.
The save function only accepts a Validate.Valid object: you can be certain the object is validated with validator before saving.
Note: you can unwrap the valid object with Validate.fromValid
To handle any additional custom events, send a Perform customEvent event and the perform function will be called with this customEvent.
Common.transition
{ badTransition = logBadRobotFormTransition
, default = defaultRobot
, perform = performCustomEvent
, save = Request.saveRobot SavedRobot
, update = updateRobotField
, validator = robotValidator
}
event
state
An error about one specific field.