【问题标题】:Yii: include form inside formYii:在表单中包含表单
【发布时间】:2013-11-13 13:53:16
【问题描述】:

有没有一种方法可以使用相同的操作将表单包含在另一个表单中? 我尝试使用 renderPartial 但不起作用。 例如:

$this->renderPartial('//utente/_form', array('model'=>new User, '条件'=>$condition, 'form' => $form, 'rule' => '3'), false, 真);

【问题讨论】:

  • 你得到的错误是什么?

标签: yii renderpartial


【解决方案1】:
  1. 使用 renderPartial(with return=true) 在时间变量中渲染 first for 的结果。
  2. 在第二个视图中使用变量。

See CController renderPartial() for details

$form1 = $this->renderPartial('firstView', $data1, true);

$this->renderPartial(
    '//utente/_form',
    array(
        'model'=>new User,
        'condition'=>$condition,
        'form' => $form,
        'rule' => '3',
        'form1' => $form1
    ),
    false,
    true
);

【讨论】:

    【解决方案2】:

    另一个表单中的表单在 HTML 中不起作用!你不能这样做:

    <form ...>
          ...
          <form ...>
              ...
          </form>
    </form>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2012-08-07
      • 2015-06-22
      • 2019-10-15
      • 2022-06-30
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多