yii2 ActiveForm及相关数据

In my mysql database exists a articleID as AI PK and a articleNumber, which can be edited by the user.

The Problem:

In a yii2 ActiveForm, I want to let the user enter the articleNumber, while saving the articleID in the background.

So far, I created several models with relations.

I've got it working in my GridView:

GridView::widget([
    'dataProvider' => $dataProvider,
    'filterModel' => $searchModel,
    'columns' => [
        [
            'attribute' => 'article.details.articleNumber',
            'label' => 'ArtNr.',
        ],
    ]
]);

In my create/edit form this does not work for me:

<?= $form->field($model, 'article.details.articleNumber')->textInput() ?>

I'm new in creating yii2 applications and couldn't find anything in the documentation. Am I using the wrong way to archive my goal or is there a trick to manage this?

You need to use multiple model form here. i.e. in your form, you need to pass two models, one for your articleNumber, and another model of your relational table for article details.

You can refer following link for example : http://blog.dedikisme.com/blog/2014/10/13/yii2-building-a-single-form-with-multiple-models