dsfdsfsdf45489 2013-02-18 23:05
浏览 41
已采纳

如何在表单配置中达到GET参数?

I'm in the middle of configure() method and I must set a default selected value for a combobox. The value is in the URL, but no request or any object.

How to reach this variable?

  • 写回答

2条回答 默认 最新

  • dongluan1901 2013-02-19 07:39
    关注

    Not a good idea to use sfContext in that context.

    Better send the parameter in the constructor of the form. Something like this:

    $form = new Form(array(), array(‘my_form_param’ => $request->getParameter('my_get_param'));
    

    In the form you can call it with:

    $this->getOption('my_form_param')
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 程序不包含适用于入口点的静态Main方法
  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记