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

Troiscent
Troiscent

Hello,

I need to alter a form of a relation manager to dynamically add fields depending on some conditions.

I could add the fields I want, but I can't find a way to set default values. Here is my code :

public function relationExtendManageWidget($widget, $field, $model) {
    // Make sure the field is the expected one
    if ($field != 'references')
        return; 
    $widget->tabs['fields']['_property'] = array(
        'label' => 'My property',
        'span' => 'auto',
        'type' => 'text',
        'tab' => 'Properties',
        'default' => 'test',
    );
}

I can see that the field is filled with "test" default value when I create a new reference, but it's empty when I click on existing reference to update. I need to define the default value everytime not only when I create a new entity. How could I do that ?

Best regards,

Alex

1-1 of 1

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