-
Notifications
You must be signed in to change notification settings - Fork 13
Add Custom Buttons
Coackroach edited this page Jan 19, 2020
·
2 revisions
You can add the custom buttons to your form wizard if you like. you have to collect all the buttons inside an array and pass it to the toolbarExtraButtons
option wrapping inside the new \yii\web\JsExpression()
call. See below how to add a single button to your formwizard.
use buttflattery\formwizard\FormWizard;
$js = <<< JS
var mybutton = $( '<button id="new"></button>' ).text( 'New Button' )
.addClass( 'btn btn-warning' ).on("click",function(e){
e.preventDefault();
alert("hello");
});
\JS;
$this->registerJs($js, yii\web\View::POS_READY);
echo FormWizard::widget([
'toolbarExtraButtons' => new \yii\web\JsExpression('[mybutton]'),
'steps' => [
[
'model' => $shootsModel,
'title' => 'My Shoots',
'description' => 'Add your shoots',
'formInfoText' => 'Fill all fields'
],
[
'model' => $shootTagModel,
'title' => 'Shoot Tags',
'description' => 'Add your shoots',
'formInfoText' => 'Fill all fields'
],
]
]);
- Get Running with Minimal Options
- Disable ActiveForm Validation
- Enable Ajax Validation
- Add Custom Buttons
- Widget Constants
- Customizing Form Fields
- Configuring File Uploads
- Custom Field Order
- Single Model Across Steps
- Multiple models in a single step
-
Tabular Steps-(New)
- Working With Widgets
- Limiting Rows
- Dependent Inputs Since v1.7.2
- Skip-able Step-(Since v1.5.0)
- Enable Preview Step-(New)
- Group Fields-(New)
- Enable Form Persistence-(New)
- Enable Edit Mode - (Since v1.6.4)