Skip to content
This repository has been archived by the owner on Jan 8, 2020. It is now read-only.

[2.1] Add DateSelect and MonthSelect elements #2175

Merged
merged 14 commits into from
Sep 14, 2012

Conversation

bakura10
Copy link
Contributor

Often, a single text input like HTML5 input or a JavaScript calendar is not an appropriate input type for dates, as birthdays. In those cases it's often easier for the user to deal with selects.

This PR brings two new Elements to the game : DateSelect and MonthSelect. They allow to render a date (day + month + year) or a month (month + year) using three or two select inputs, respectively.

Of course, it makes use of the Intl extension so that the month names, order and separator are the one of the locale used.

I'm going to write the doc right now and should make a PR in one hour.

EDIT 2 : you can now add specific attributes for every element. Here is an example of everything work in one of my application : https://gist.github.com/3705417

@travisbot
Copy link

This pull request passes (merged eb27880 into 910a7b7).

@travisbot
Copy link

This pull request fails (merged 056a5ba into 910a7b7).

@travisbot
Copy link

This pull request fails (merged b201562 into 910a7b7).

@Maks3w
Copy link
Member

Maks3w commented Aug 15, 2012

@starJammer
Copy link

I was going to write an element like this. I needed it. You beat me to it. Can't wait to use your code.

@bakura10
Copy link
Contributor Author

Feel free to test it so ! ,-)

* @package Zend_Form
* @subpackage View
*/
class FormMonthSelect extends FormDateSelectHelper
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be possible for FormDateSelect to additively extend from FormMonthSelect, rather than subtracting out the "day" functionality?

@cgmartin
Copy link
Contributor

Looking forward to using this as well. :)

use Zend\Validator\ValidatorInterface;
use Zend\Validator\Regex as RegexValidator;

class MonthSelect extends DateSelect
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same note here as in FormMonthSelect ... Could DateSelect instead additively extend from MonthSelect?

@bakura10
Copy link
Contributor Author

Done !

Thanks for the feedback.

@travisbot
Copy link

This pull request passes (merged d5c62e0 into 022113e).

@travisbot
Copy link

This pull request fails (merged 25b521a into 7abc7f2).

@travisbot
Copy link

This pull request passes (merged 7e985d7 into de807ff).

@travisbot
Copy link

This pull request fails (merged d651f55 into de807ff).

@weierophinney weierophinney merged commit cee8b1d into zendframework:master Sep 14, 2012
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants