dongxing2015 2016-08-08 06:26
浏览 32
已采纳

将id传递给modals symfony 2.3

Is there any way to pass id's to modals in symfony 2.3?

here's an example:

<a href="{{ path('route', {'id':table.id}) }}" data-reveal-id = "modal" class = "icon" etc.>

so first, without the data reveal the icon becomes a link that when clicked, it goes to the action in the route. That's fine since it's working.

<div id="modal" class="reveal-modal large">
    <input type="password" id="someid"/>

In my modal I have a password input type, I have a jquery that submits this form, my problem is that this time the code doesn't go to the route.

Anyone with answers will be greatly praised. I swear you won't hear me but I WILL be praising you, thanks in advance.

P.S. I'm fairly new to symfony and the 2.3 documentation just vanished from the site so i'm not sure where to get the info I need other than here.

  • 写回答

1条回答 默认 最新

  • douxianwu2221 2016-08-08 08:23
    关注

    Set the form 'action' attribute with setAction, when you create your form :

    $form = $this->createFormBuilder($entity)
    ->setAction($this->generateUrl('route',array('id'=>$table->getId())))
    ->setMethod('GET')
    ->add('name', 'text')
    ->getForm();
    

    or

    $form = $this->createForm(
        'my_form_type',
         $entity,
         array('action'=>$this->generateUrl('route',array('id'=>$table->getId()))
    ));
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥50 永磁型步进电机PID算法
  • ¥15 sqlite 附加(attach database)加密数据库时,返回26是什么原因呢?
  • ¥88 找成都本地经验丰富懂小程序开发的技术大咖
  • ¥15 如何处理复杂数据表格的除法运算
  • ¥15 如何用stc8h1k08的片子做485数据透传的功能?(关键词-串口)
  • ¥15 有兄弟姐妹会用word插图功能制作类似citespace的图片吗?
  • ¥200 uniapp长期运行卡死问题解决
  • ¥15 latex怎么处理论文引理引用参考文献
  • ¥15 请教:如何用postman调用本地虚拟机区块链接上的合约?
  • ¥15 为什么使用javacv转封装rtsp为rtmp时出现如下问题:[h264 @ 000000004faf7500]no frame?