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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T08:32:08+00:00 2026-06-18T08:32:08+00:00

With the newly released version of Zend Framework 2, two new form elements were

  • 0

With the newly released version of Zend Framework 2, two new form elements were added; DateSelect and MonthSelect. I want to use the former, which adds three selects; day, month and year. However, I have a problem formatting the output how I want – and, there is no documentation for this!

I am adding the form element to my form like this (taken from this page):

$this->add(array(
    'type'    => 'Zend\Form\Element\DateSelect',
    'name'    => 'birthDate',
    'options' => array(
        'label'               => 'Date',
        'create_empty_option' => true,
        'day_attributes'      => array(
            'data-placeholder' => 'Day',
            'style'            => 'width: 20%',
        ),
        'month_attributes'    => array(
            'data-placeholder' => 'Month',
            'style'            => 'width: 20%',
        ),
        'year_attributes'     => array(
            'data-placeholder' => 'Year',
            'style'            => 'width: 20%',
        )
    )
));

For outputting, I am doing like this:

echo $this->formDateSelect($form->get('birthDate'));

The thing is that I don’t know how to control the way the selects are formatted. For instance, they are currently outputted in this form: [month] [day], [year]. I want to change two things; first, I want to switch the day and month, and secondly, I want to get rid of the comma.

The helpers use the IntlDateFormatter class to format the selects. In the source code, I noticed that you can use the predefined constants for the date type when calling __invoke() [link to source code], like this:

echo $this->formDateSelect($form->get('birthDate'), IntlDateFormatter::SHORT);

Having tried all of the constants, I still cannot get the format I want.

I noticed that there are getters for the three selects, but using the formSelect view helper with each of them, empty selects are rendered because the data population is within the new view helpers. So that pretty much defeats the purpose of even using the selects individually; then I might as well just use regular selects.

Does anyone have any idea how I can gain more control on how my selects are formatted? Is it even possible without too much hassle, or should I just use three regular selects for maximum flexibility?

  • 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-18T08:32:10+00:00Added an answer on June 18, 2026 at 8:32 am

    The format of the ViewHelper is $this->formDateSelect($element, $intlFormat, $locale).

    With this being said, you should be able to create the output you want by accessing your current locale setting and insert int into the ViewHelpers __invoke(). Seeing the getLocale() of the ViewHelper implies, that the default translator from configuration is not used, so you have to set a locale explicitly for this ViewHelper, but then it should work out just fine 😉

    If that doesn’t work as expected for you, i may advise you to hit Bakura a message on his Blog about the new Form Features

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

Sidebar

Related Questions

I try to get a stable version of the newly released Zend Framework 2
I use an external developer for a new version of my iphone app. Now,
We are thinking to use the newly released EF 4.3.x http://blogs.msdn.com/b/adonet/archive/2012/02/09/ef-4-3-released.aspx does anybody know
Just looking through the newly released Gingerbread documents and I see they've added some
Does anyone knows what newly released .NET Framework 4 KB2162169 contain? Any links would
How can I print documents with the newly released Firemonkey framework?
What version of MonoTouch is needed to use the newly release Xcode 4.3.2 It
What I want to do I've been playing around with the newly released Silverlight
I'm attempting to upgrade quite a large Django project to the newly released Django
can you get the last or newly added element in std::set? for example say

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.