doukengsha9472 2014-01-15 09:04
浏览 24
已采纳

PUGXMultiUserBundle表单提交返回表单,数据库不变(Symfony2)

I'm dealing with something quite stupid here (I think).

I'm using PUGXMultiUserBundle in a Symfony2 project, but submitting a registration form (for each of my register form types) takes me back to the same form, and I don't know what I'm doing wrong.

Assuming I've followed "succesfully" steps 1..6 from PUGXMultiUserBundle documentation (https://github.com/PUGX/PUGXMultiUserBundle/blob/master/Resources/doc/index.md), and having the above stated behaviour... Where did I mess so badly?

*PUGXMultiUserBundle code and behaviour is spread along many files, I will provide the code you guys need to help to identify the issue, if we can circle it to a certain part.

Thanks in advance!

  • 写回答

1条回答 默认 最新

  • douyou7072 2014-01-15 09:14
    关注

    <kbd>1</kbd> Make sure you've setup the route correctly:

    # Acme/UserBundle/Resources/config/routing.yml
    user_one_registration:
        pattern:  /register/user-one
        defaults: { _controller: AcmeUserBundle:RegistrationUserOne:register }
    
    user_two_registration:
        pattern:  /register/user-two
        defaults: { _controller: AcmeUserBundle:RegistrationUserTwo:register }
    

    <kbd>2</kbd> When you go at /register/user-one, you should see:

    AcmeUserBundle:Registration:user_one.form.html.twig, and when you go at /register/user-two, you should see AcmeUserBundle:Registration:user_two.form.html.twig

    <kbd>3</kbd> And I have a feeling your error is in your template:

    So, when you submit the form in your view, you have to submit it to the right method:

    In AcmeUserBundle:Registration:user_one.form.html.twig:

    <form action="{{ path('user_one_registration') }}" {{ form_enctype(form) }} method="POST">
    

    In AcmeUserBundle:Registration:user_two.form.html.twig:

    <form action="{{ path('user_two_registration') }}" {{ form_enctype(form) }} method="POST">
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 Vue3 大型图片数据拖动排序
  • ¥15 划分vlan后不通了
  • ¥15 GDI处理通道视频时总是带有白色锯齿
  • ¥20 用雷电模拟器安装百达屋apk一直闪退
  • ¥15 算能科技20240506咨询(拒绝大模型回答)
  • ¥15 自适应 AR 模型 参数估计Matlab程序
  • ¥100 角动量包络面如何用MATLAB绘制
  • ¥15 merge函数占用内存过大
  • ¥15 使用EMD去噪处理RML2016数据集时候的原理
  • ¥15 神经网络预测均方误差很小 但是图像上看着差别太大