Is it possible to render i.e. input field without id? I am in a strange situation where I sometimes have to use two of the same forms within the same page and I cannot have two identical id's obviously. Luckily I don't really need them (no labels needed either). So is there a way to have a form fields without them? I'd like to disable them in template code if possible
1条回答 默认 最新
- doupapin172773 2012-03-23 16:56关注
If you want to do it in your template:
<?php echo $form['my_field']->render(array('id' => '')) ?>
Or in your form class:
public function setup() { parent::setup(); $this->widgetSchema['my_field'] = new sfWidgetFormInput(array(), array('id' => '')); }
本回答被题主选为最佳回答 , 对您是否有帮助呢?解决 无用评论 打赏 举报