Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update multiple select2 #354

Open
juniorlira opened this issue Jan 29, 2018 · 1 comment
Open

Update multiple select2 #354

juniorlira opened this issue Jan 29, 2018 · 1 comment

Comments

@juniorlira
Copy link

juniorlira commented Jan 29, 2018

Hi, I'm starting to use YII2, but I'm having an error when updating select2.

my controller
`

public function actionUpdate($id)
{
$model = $this->findModel($id);
$alunoModulo = new AlunoModulo();
$alunoModulo = AlunoModulo::find()->where(['id_modulo'=>$id])->All();
if ($model->load(Yii::$app->request->post()) && $model->save()) {
return $this->redirect(['index']);
} else {
return $this->render('update', [
'model' => $model,
'alunoModulo'=> $alunoModulo,
]);
}
}
`

My View:
`

field($alunoModulo, 'id_aluno')->widget(Select2::classname(), [ 'data' => ArrayHelper::map(User::find()->where(['role_id'=>3])->all(),'id','username'), 'language' => 'br', 'options' => ['placeholder' => Yii::t('app', 'Select the student ...'),'multiple' => true,], 'pluginOptions' => [ 'allowClear' => true, ], ]);?>

`

error:
Call to a member function isAttributeRequired() on array

thanks


Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

@mavelar
Copy link

mavelar commented Apr 4, 2019

Same issue here, did you find a solution?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants