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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T10:23:36+00:00 2026-06-18T10:23:36+00:00

I have a FormType that have this datetime input: $builder->add(‘data_inicio’, ‘datetime’, array( ‘input’ =>

  • 0

I have a FormType that have this datetime input:

    $builder->add('data_inicio', 'datetime', array(
        'input' => 'datetime',
        'date_widget' => 'single_text',
        'time_widget' => 'choice',
        'attr' => array(
            'class' => 'datetime rangeDataInicio',
            'maxlength' => '10',
            'placeholder' => 'dd/mm/aaaa',
        ),
        'date_format' => 'dd/MM/yyyy',
        'required' => true,
        'disabled' => $isDisabled,
    ));

Form some reasons, I have to insert the placeholder and the class direct at the single_text date input, but both of them stays at the container and don’t go to the input.

I tried a several ways to do this and all of them failed and searched the web for a couple of weeks and found nothing that could sove my problem. How can I put these two attrs at the input?

  • 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-18T10:23:37+00:00Added an answer on June 18, 2026 at 10:23 am

    You can use form theme for this.

    {% form_theme form _self %}
    
    {% block datetime_widget %}
    {% spaceless %}
        {% if widget == 'single_text' %}
            {{ block('field_widget') }}
        {% else %}
            <div {{ block('widget_container_attributes') }}>
                {{ form_errors(form.date) }}
                {{ form_errors(form.time) }}
                {{ form_widget(form.date) }}
                {{ form_widget(form.time, { 'attr': {'class': 'datetime rangeDataInicio', 'placeholder': 'dd/mm/aaaa'} })) }}
            </div>
        {% endif %}
    {% endspaceless %}
    {% endblock datetime_widget %}
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

FormType: class BranchFormType extends AbstractType { public function buildForm(FormBuilderInterface $builder, array $options) { $builder->add('name');
I have an add form that allows me to add the specific field into
in my entity i have set this public function setExpiry(\DateTime $expiry = null) {
My form looks like this: public function buildForm(FormBuilderInterface $builder, array $options) { $factory =
I have an entity ,there is a array type attribute:productKey.I try to add a
I have a PostType form that extends AbstractType. In controller I'd like to add
have written this little class, which generates a UUID every time an object of
have a problem. At first look at this HTML <div id=map style=background-image: url(map.png); width:
I have form that sends message me when enter Email and MessageText. I want
I have a query (ContactFormTypesRequired) that returns ContactID and FormTypeID utilizing related tables that

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.