This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.

jasonwong
jasonwong

I need add a field to update.htm, I tried defind the formExtendFields method in the controller class:

public function formExtendFields($form) {
    $form->addFields(['test' => ['label'=>"test", "default"=>"this is a test value"]]);
}

The page has displayed that field, but the value are empty, does not appear value with 'this is a test value'.

I tried another code:

public function formExtendFields($form) {
    $form->addFields(['test' => ['label'=>"test", "attributes"=>['value'=>"this is a test value"]]]);
}

Still the same, the value are empty too of 'test' field.

This is a BUG or am I was wrong?

Last updated

daftspunky
daftspunky

The default field should only appear if the model does not already exist. Install the test plugin to plugins/october/test and notice when you create a new Country, the default values are populated.

Confirmed this is not a bug.

1-2 of 2

You cannot edit posts or make replies: the forum has moved to talk.octobercms.com.