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 7720765
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T03:45:12+00:00 2026-06-01T03:45:12+00:00

I am new to symfony. I have created a registration form using the code:

  • 0

I am new to symfony. I have created a registration form using the code:

$user = new Register();
$form = $this->createForm(new RegisterType(), $user);

In the RegisterType class i have 5 fields (for example).I store the values in database when the user registers with the system. Now I display the EDIT page using following code:

$user = $em->getRepository('MysiteUserBundle:Register')->find($id);
$form = $this->createForm(new RegisterType(), $user);

//edit.html.twig code

        <form action="{{ path('MysiteUserBundle_register_update',{'id':user.id}) }}" method="post" {{ form_enctype(form) }} class="register">
            {{ form_errors(form) }}

            {{ form_row(form.firstname) }}
            {{ form_row(form.lastname) }}
            {{ form_row(form.username) }}



          <p>
             <input type="submit" value="Submit">
              </p>
           </form> 

The problem with the EDIT code however is that it displays me all of the fields mentioned in RegisterType class.Is it possible to display only some fields. If yes how can this be achieved. Any help will be appreciated

  • 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-01T03:45:13+00:00Added an answer on June 1, 2026 at 3:45 am

    It doesn’t make sense to use the registration form type to edit a user, because registration happens once per user. Instead you could create another form type with only those fields you need when editing a user. One can extend the other to avoid duplication.

    You could also:

    • Keep just one form type but add some fields conditionally — that is, only when the entity is new. You can get your entity in the form type as $options['data'] and check if its ID is not null or whatever.
    • Use form events.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using Symfony 1.4 and Propel as ORM. I have created a form
I'm new to Symfony. Is my understanding correct that the User class is actually
I'm trying to override FOSUserBundle form Edit profile ; I have created the class
I have a form created with Symfony forms. and in the template i have
I use symfony 1.4 In my index page, I have created some fields as
I am using Symfony 1.4.8 and Propel as ORM. I have created a custom
I am building a Symfony project, and have created a new plug-in named sfUtilsPlugin
I am new to Symfony. I created a layout page in which I have
I have created a nice registration frontend app for registering new users for an
I'm using symfony 1.4 doctrine. I have a code that can validate phone numbers

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.