0
部分listForm.class.php:embedForm額外字段隱藏我的代碼
public function configure() {
$list_id = $this->getOption('list_id');
$endkunde_id = $this->getOption('endkunde_id');
$shopname_id = 1;
$todoWrapperForm = new sfForm();
$todoWrapperForm = new sfForm();
//$todos = Doctrine_Core::getTable('Todo')->findAll();
//$todos = Doctrine_Core::getTable('EinkaufslisteElemente')->findAll();
$todos = Doctrine_Core::getTable('EinkaufslisteElemente')
->createQuery('ee')
->where('ee.einkaufsliste_id = ?', $list_id)
->innerJoin('ee.Einkaufsliste e')
->andWhere('e.shopname_id = ?', $shopname_id)
->innerJoin('e.EinkaufslisteEndkunde ek')
->execute();
foreach ($todos as $todo) {
$todoWrapperForm->embedForm($todo->getId(), new EinkaufslisteElementeForm($todo));
}
$todoWrapperForm->embedForm('new_1', new EinkaufslisteElementeForm()); // add one blank todo to start
$this->embedForm('todos', $todoWrapperForm);
$this->list = new sfWidgetFormTextarea(array(), array('rows' => '10', 'cols' => '35'));
$this->mergePostValidator(new sfValidatorDoctrineUnique(array('model'=>'todo', 'column'=>'task'), array('required' => false))) ;
$this->widgetSchema->setNameFormat('todo_list[%s]');
}
我想創建一個從他的名字「客戶」,這是不是隱藏着一個額外的領域,我想創建一個輸入字段用List'List'中的list_id隱藏。我怎麼用embedForm做到這一點?
你爲什麼想在你的'embedForm'中做到這一點?由於它與listForm相關,因此將其放入內部。 – j0k 2012-07-12 10:30:14
那我怎麼把它放進去呢? – craphunter 2012-07-12 10:31:17
使用sfWidgetFormInputHidden? – j0k 2012-07-12 10:35:14