二开问题

技术问题 · tesren · 于 3年前 发布 · 1600 次阅读

想咨询一个二开的问题,可能很简单,但是一直找不到这方面的信息 我view里面使用了一个widget MultipleInput用来选择产品信息 $form->field($modelInf, 'invoiceinfo')->widget(MultipleInput::className(), [

					'max' => 10,
					'cloneButton' => true,
					'columns' => [
						[
							'name'  => 'number',
							'type'  => \kartik\select2\Select2::class,
							'title' => '商品',
							'defaultValue' => 1,
							.....

但是提交后,在控制器里面怎么都接收不到数据 控制器里面 $modelInf->load(Yii::$app->request->post()) $modelInf->save(false); 插入数据库是空 var_dump($modelInf) 也是空 请问,这个MultipleInput 怎么接收数据 谢谢

共收到 4 条回复
Fecmall#13年前 0 个赞

1.看不懂,看不明白,你这个是yii2的还是fecmall的?

2.代码不写上文件路径,鬼知道你说的是什么?标题,内容都描述清楚!!!

3.看三遍:http://www.fecmall.com/topic/624

tesren#23年前 0 个赞

这是yii的问题、 view页面: <?= $form->field($modelInf, 'invoiceinfo')->widget(MultipleInput::className(), [

					'max' => 10,
					'cloneButton' => true,
					'columns' => [
						[
							'name'  => 'number',
							'type'  => \kartik\select2\Select2::class,
							'title' => '商品',
							'defaultValue' => 1,
							 'options' => [
								 'data'  =>[ArrayHelper::map(\backend\models\Goods::find()->asArray()->all(), 'id', 'number')],
							 ],
						],
					    [
					        'name'  => 'degrees',
					        'title' => '度数',
					        'defaultValue' => 0,
					        'enableError' => true,
					        'options' => [
					        									'class' => 'input-degrees',
					        ]
					    ],
					    [
					        'name'  => 'astigmia',
					        'title' => '规格',
					        'defaultValue' => 0,
					        'enableError' => true,
					        'options' => [
					        									'class' => 'input-astigmia',
					        ]
					    ],
						[
							'name'  => 'qty',
							'title' => '数量',
							'defaultValue' => 1,
							'enableError' => true,
							'options' => [
							]
						],
						[
							'name'  => 'price',
							'title' => '单价',
							'defaultValue' => 0.00,
							'enableError' => true,
							'options' => [

							]
						]
					]
				])->label(false); ?> 

controller文件:

if ($modelInf->load(Yii::$app->request->post())) {

        $modelInf->save(false); 
		return $this->redirect(['view', 'id' => $user->id]);

    } else {
        return $this->render('create', [
            'modelInf' => $modelInf,
        ]);
    }
Fecmall#33年前 0 个赞

1.markdown排版问题:http://www.fecmall.com/markdown

2.yii2封装的form,我感觉耦合太紧密,就一直没有用,也没有仔细去看这部分的源码,因此帮不上忙,您可以去www.yiichina.com 求助一下

Yiichina问答:https://www.yiichina.com/question

tesren#43年前 0 个赞

哦,谢谢

添加回复 (需要登录)
需要 登录 后方可回复, 如果你还没有账号请点击这里 注册
Your Site Analytics