October CMS resources and help articles

Simple and to the point. Optimized by the community.

How to set default values for backend form fields

9
by OFFLINE, last modified on March 22nd, 2021

In your controller, use the formExtendModel method to set the model's properites:

    public function formExtendModel($model)
    {
        if ($this->formGetContext() === 'create') {
            $model->your_field = 'Your default value';
        }
    }

Discussion

0 comments

We use cookies to measure the performance of this website. Do you want to accept these cookies?