复选框输入在cakephp 3.5中不起作用

时间:2017-12-13 09:54:15

标签: cakephp cakephp-3.0 cakephp-3.4

这是我的add.ctp

       <?php
       $options = ['Offer' => 'Offer','COA' => 'COA','Purchase' => 'Purchase'];
       echo $this->Form->select('product_data_tests.n2.purpose', $options, ['multiple' => 'checkbox']);
       ?>

在控制器下:

       foreach ($this->request->data['product_data_tests'] as $key => &$productDataCheck){
            $productDataCheck["purpose"]=implode(", ",$productDataCheck["purpose"]);
        }

        if ($this->ProductsMaster->save($productsMaster)) {
            $this->Flash->success(__('The {0} has been saved.', 'Products Master'));
            return $this->redirect(['action' => 'index']);
        } else {
            $this->Flash->error(__('The {0} could not be saved. Please, try again.', 'Products Master'));
        }

在提交表单时,它无法保存并且收到错误无法保存。请再试一次。 对一个输入字段中的“保存多个”复选框进行替换或更正

0 个答案:

没有答案