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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T04:52:40+00:00 2026-06-18T04:52:40+00:00

Using symfony2.1. I do build a form in Form/RegisterUser.php public function buildForm(FormBuilderInterface $builder, array

  • 0

Using symfony2.1.

I do build a form in Form/RegisterUser.php

public function buildForm(FormBuilderInterface $builder, array $options) {
    $builder->add(
        'email',
        'email',
        array('attr' => array('placeholder' => 'email.placeholder')));
    $builder->add(
        'password',
        'repeated',
        array(
            'first_name' => 'password',
            'second_name' => 'confirm',
            'type' => 'password',
            'invalid_message' => 'register.password.repeat', ));
    $builder->add("t_and_c", "checkbox", array("mapped" => false, ));

    // "True" validator on the form for t&c
    $builder->addValidator(new CallbackValidator( function(FormInterface $form) {
        if (!$form["t_and_c"]->getData()) {
            $form->addError(new FormError('Please accept the terms and conditions in order to register'));
        }
    }));
}

/**
 * Returns the default options for this form type.
 * @param array $options
 * @return array The default options
 */
public function getDefaultOptions(array $options) {
    return array('data_class' => 'Frontend\AccountBundle\Entity\User');
}

And in app/Ressources/translation/validators.LANG.yml:

<trans-unit id="6">
    <source>email.placeholder</source>
    <target>Enter email.</target>
</trans-unit>
<trans-unit id="12">
    <source>register.password.repeat</source>
    <target>Passwords don't match.</target>
</trans-unit>

The field invalid_message is going to be translated but not the field email.placeholder. Is there a bug? I don’t usw twig and do a normal render.

  • 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-18T04:52:42+00:00Added an answer on June 18, 2026 at 4:52 am

    Translated error messages go into your validators.LANG.yml like you did right.
    But everything else needs to go into your messages.LANG.yml.

    Also I’m a bit confused by how you are formatting your yml. Normally you write it like this:

    email:
        placeholder: Enter email.
    
    register:
        password:
            repeat: Passwords don't match
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to create a nationality from field using Symfony2.1: public function buildForm(FormBuilderInterface
I'm using Symfony2 form component to build and validate forms. Now I need to
I am using a login form on Symfony2 with the following controller code public
I'm trying to build a form using symfony2, but I keep getting the error
I am using Symfony2 and Doctrine2 to build an application. One part of the
I'm using Symfony 2.1 to build a website with a little login form. I'm
I am using symfony2 and have a form to save the relation of one
The user sumbits a form that was build using the symfony 2 framework with
I am using Symfony2 flash messages in my forms to build different views after
Using Symfony 2.1.3-dev and Doctrine 2.3 I am attempting to build a form which

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.