dqpwdai095465 2012-03-23 15:34 采纳率: 100%
浏览 21
已采纳

在symfony表单字段中禁用id渲染

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' => ''));
    }
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 孟德尔随机化结果不一致
  • ¥15 深度学习残差模块模型
  • ¥50 怎么判断同步时序逻辑电路和异步时序逻辑电路
  • ¥15 差动电流二次谐波的含量Matlab计算
  • ¥15 Can/caned 总线错误问题,错误显示控制器要发1,结果总线检测到0
  • ¥15 C#如何调用串口数据
  • ¥15 MATLAB与单片机串口通信
  • ¥15 L76k模块的GPS的使用
  • ¥15 请帮我看一看数电项目如何设计
  • ¥23 (标签-bug|关键词-密码错误加密)