This repository has been archived by the owner on Jan 8, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
[2.1] Add DateSelect and MonthSelect elements #2175
Merged
weierophinney
merged 14 commits into
zendframework:master
from
bakura10:form/select-date
Sep 14, 2012
Merged
[2.1] Add DateSelect and MonthSelect elements #2175
weierophinney
merged 14 commits into
zendframework:master
from
bakura10:form/select-date
Sep 14, 2012
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
I was going to write an element like this. I needed it. You beat me to it. Can't wait to use your code. |
Feel free to test it so ! ,-) |
* @package Zend_Form | ||
* @subpackage View | ||
*/ | ||
class FormMonthSelect extends FormDateSelectHelper |
There was a problem hiding this comment.
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?
Looking forward to using this as well. :) |
use Zend\Validator\ValidatorInterface; | ||
use Zend\Validator\Regex as RegexValidator; | ||
|
||
class MonthSelect extends DateSelect |
There was a problem hiding this comment.
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?
Done ! Thanks for the feedback. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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