Yii Framework Forum: yii2-multiple-input - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

yii2-multiple-input Rate Topic: -----

#1 User is offline   jahau 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 42
  • Joined: 05-February 17

Posted 18 April 2018 - 12:37 AM

Hi,

The documentation on yii2-multiple-input widget seems to be quite limited.

I've got currently workproduct that has materials, which is introduced in its own model class. The following code works, but...

1) How do I change the widget title (currently it uses the materials somehow automatically)?
2) How do I handle the data in the controller and save it finally to the materials model? I didn't find any examples.

        <?= $form->field($model, 'materials')->widget(MultipleInput::className(), [
            'max' => 100,
            'columns' => [
                [
                    'name'  => 'materialid',
                    'type'  => 'dropDownList',
                    'title' => $material->attributeLabels()['materialid'],
                    'defaultValue' => 0,
                    'items' => $model->activeMaterialsWithIDs
                ],
                [
                    'name'  => 'materialamount',
                    'title' => $material->attributeLabels()['materialamount'],
                    'enableError' => true,
                    'options' => [
                        'type' => 'number'
                    ]
                ]
            ]
        ]);


Thanks!
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users