A simple alternative to multiform
This module does not require storage in the back end and provide a somewhat easier DX.
Each step of your form should be named the same.
They should all extends the base MultiStepForm
class and implements the following abstract methods:
class MyFormStep1 extends MultiStepForm
{
public static function getStepTitle()
{
return 'My Step';
}
public function buildFields()
{
$fields = new FieldList();
return $fields;
}
}
In your controller, you declare a form like this:
private static $allowed_actions = array(
'MyForm'
);
public function MyForm()
{
$class = MyFormStep1::classForCurrentStep($this);
return new $class($this);
}
You can display the steps using
$MyForm.DisplaySteps
This relies on some default styles that are added by default. You can disable styles and edit custom classes with:
LeKoala\MultiStepForm\MultiStepForm:
include_css: true
class_active: 'current bg-primary text-white'
class_inactive: 'link'
class_completed: 'msf-completed bg-primary text-white'
class_not_completed: 'msf-not-completed bg-light text-muted'
Tested with 4.6 but should work on any ^4.4 projects
LeKoala - [email protected]
Module rating system helping users find modules that are well supported. For more on how the rating system works visit Module standards
Score not correct? Let us know there is a problem