Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8529487
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T09:02:42+00:00 2026-06-11T09:02:42+00:00

I have successfully installed FOSUserBundle in my project and everything works as expected. However,

  • 0

I have successfully installed FOSUserBundle in my project and everything works as expected. However, I am struggling with how to implement it in my actual project.

I want to create the following setup:

  • A page displaying some user settings in one form (like newsletter subscription), the possibility to change the password in a second form and maybe also a third form to change the username.

  • The settings form as well as some more information is coming from an existing action in my controller and is working well.

I did try a few things but things are not really working out yet:

  • I copied some functionality from FOSUserBundle\Controller\ChangePasswordController\changePasswordAction() to my own action. This way I could get the change password form, create the view and pass it to my template.

  • I added the form to my template with {{ form_widget(form) }}. The form is being displayed and it’s even working. I can change the password. However, the labels are being lost, simply reading Current, First, and Second. Also there is no error messaging showing up when the two new passwords don’t match or are being left empty.

Over all I have the feeling I am probably doing this in a wrong way. Could you please help me how I should handle this task and point out where I am likely doing something stupid?

Here is the code of my action, reduced to what’s important here:

# src/Acme/MyBundle/Controller/BackendController.php
public function accountAction(){

    //pretty much a copy of FOSUserBundle\Controller\ChangePasswordController\changePasswordAction()
    $user = $this->get('security.context')->getToken()->getUser();
    $form = $this->container->get('fos_user.change_password.form');
    $formHandler = $this->container->get('fos_user.change_password.form.handler');

    $process = $formHandler->process($user);
    if ($process) {
       //password has been changed, response will be generated
    }

    //more stuff going on here
    $moreStuff = ...

    //render view
    return $this->render('AcmeMyBundle:Backend:account.html.twig', array(
        'form' => $form->createView(),
        'moreStuff' => $moreStuff
    ));
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T09:02:43+00:00Added an answer on June 11, 2026 at 9:02 am

    IMO rendering more than one form in one action is not a good idea.
    Always try to separate things and let an action handle only one feature.

    In your twig template I suggest to use the render method :

    {% render 'AcmeBundle:SomeAction' with{'param:param} %}
    

    It will generate a GET request on the action provided with some params if needed.

    Create one action that will render the twig template with subrequests :

    // AcmeUserBundle:editAction
    
    {% render 'AcmeUserBundle:changePasswordAction' %}
    {% render 'AcmeUserBundle:settingsAction' %}
    {% render 'AcmeUserBundle:profileAction' %}
    

    And then you’ll need to create one action per form.

    For password and username modification you can also override FOSUserBundle views if your needs are only visual. If you need to add/remove a field on the form you will need to create a new service.

    I sugget reading FOSUserBundle documentation about overriding :

    https://github.com/FriendsOfSymfony/FOSUserBundle/blob/master/Resources/doc/index.md#next-steps

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have successfully installed following items as i want to Integrate Facebook Chat Into
I am currently struggling with the following problem. I have successfully installed Apache2 and
I have successfully installed Eclipse and the Android SDK on Fedora 16. However, when
I am embarking upon a NLP project for sentiment analysis. I have successfully installed
I have successfully installed Node.js, now I want to install the websocket module found
I want to create an OpenOffice.org plug-in that adds a sidebar. I have successfully
Hi i have successfully installed monodevelop on CentOS 5.5 using the EPEL repo. However
I have successfully installed Oracle 11g R2 version. I don't have good knowledge about
I am an Emacs and Common Lisp novice. I have successfully installed SLIME in
I have just successfully installed CakePHP and I see that I can edit the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.