Closed Ediphonce closed 4 years ago
Hmm.. i dont think i have handled this scenario, give me a day and i will test and add a fix for this. currently there aint no support of providing the column names for the steps with the table names.
Thank you @buttflattery for quick response, I'am looking forward for the fix.
Hello @Ediphonce i have added the support for using multi model steps with similar fields in the new release 1.6.8 you can run composer update
to update the widget to the latest version and then you can prefix the field names with the model name, the widget uses $model->formName()
method so be careful if you have overridden the formName()
function in your model then use the relevant name.
See an example below where you need to use the Book
and User
model both in one step and you have the name
field in both the tables/models.
'fieldConfig'=>[
'user.name'=>[
'options'=>[
'class'=>'my-class',
'placeholder'=>'Enter User Name'
]
],
'book.name'=>[
'options'=>[
'class'=>'my-class'
'placeholder'=>'Enter Book Name'
]
],
]
You can close the issue if you dont run into any problems.
Hi @buttflattery, thank you for the update it is working, I appreciate your great work.
@Ediphonce you are welcome
I would like to utilize the multiple models feature, but my models has attributes with similar names ( model_one.name and model_two.name) , how can I reference them. I tried hiding one of them by using the code below but it is not working. 'model_two.name' => false,
here is the full code: [ 'model' => [$model_one,$model_two], 'title' => 'Project Details', 'description' => 'Enter Project Details', 'formInfoText' => '', 'fieldConfig' => [ 'created_at' => false, 'updated_at' => false, 'budget' => false, 'currency' => false, 'model_two.name' => false, 'name' => [ 'widget' => Select2::classname(), 'options' => [ 'data' => ArrayHelper::map(Partner::find()->all(), 'id', 'name'), 'language' => 'sw', 'options' => ['placeholder' => 'Select Partner...'], 'pluginOptions' => [ 'allowClear' => true ], ] ], ], ],