Autofill Fields in fields.yaml


I am making a custom setting form for a plugin in the backend. I have render the form in controller index.htm and saving the form onSave event. however now i am lost how to populate the form entries from config/database table.

the database table is my_clients_setting.

the columns are:
id (PK),
status(booloean => switch)
key(identifier => string)
value(value of the form => string)

        label: ''
        span: full
        on: Disable
        off: Enable
        type: switch
        label: Key
        span: auto
        disabled: 1
        type: text
        value: 'Test'
        label: Value
        span: auto
        type: text

following is my controller

public $implement = [
        'Backend\Behaviors\FormController'    ];

    public $listConfig = 'config_list.yaml';
    public $formConfig = 'config_form.yaml';

    public function __construct()
        BackendMenu::setContext('My.Clients', 'main-menu-clients', 'side-menu-client-settings');

    public function index() {
        $this -> initForm($this);
        $this -> pageTitle = 'My Clients Settings';

    public function onSave(){
        $saveSettings = new \My\Clients\Models\MyClientsSettings();
        $saveSettings->status = true;
        $saveSettings->key = 'key';
        $saveSettings->value = 'value';

i saw this article which is what i want to have but it is not very clear that how one can implement this in a custom controller/form

Thank you in advance

Try extending the form fields:

Something like this:

public function formExtendFields($form)
    $form->getField('myfield')?->value = 'default value';