Allow to create empty option in Select #2288

merged 16 commits into from Sep 10, 2012


None yet
9 participants

bakura10 commented Sep 2, 2012

DOES NOT break BC.

This PR adds an option to every Select element in order to automatically prepend an empty option to a select element. This is useful either in a user experience point of view, but most often because a lot of JavaScript libraries need an empty option to render, for instance, a placeholder value.

EDIT : it now instead allows to specify a string for the empty option. This string will be used as the label for the empty option, but without any value. This is by far more flexible as it allows to set either an empty string or a kind of placeholder.

This pull request fails (merged 9e881d7 into 3a4cee6).

This pull request passes (merged 4eb320f into 3a4cee6).

kuwabarahiroshi and others added some commits Sep 3, 2012

@kuwabarahiroshi kuwabarahiroshi Modified status line parser regexp.
HTTP response should accept status line with zero length reasen phrase.
@kpieters kpieters ZF2-514 Fixed fatal error when using expression in columns part of a …
…join, Added unit test, fixed typo's in unit test
@xtreamwayz xtreamwayz Update library/Zend/Form/Element/Range.php
This does not give the required result. It gives the isset result which is a boolean true or false.
(isset($this->attributes['min'])) ?: 0

This does work. It adds the value as expected.
(isset($this->attributes['min'])) ? $this->attributes['min'] : 0, 
@weierophinney weierophinney Merge branch 'patch-1' of ef90275
@weierophinney weierophinney Merge branch 'master' of b5f1a44
@ralphschindler ralphschindler Merge branch 'hotfix/ZF2-514' of git:// into k…
@ralphschindler ralphschindler Zend\Db\Sql\Select: simpler test for ZF2-514 9c85cc3
@xtreamwayz xtreamwayz Pass the right validator options
Same issue as with zendframework#2293

It passes the value of isset and not the min/step attribute.
@bakura10 bakura10 Add unit test ebf819e
@weierophinney weierophinney Merge branch 'prg-use-params' of ceeccff
@weierophinney weierophinney Merge branch 'patch-2' of 2db58cf
@Slamdunk Slamdunk Notifications now to e02a3b4
@padraic padraic Merge pull request #2302 from Slamdunk/patch-1
Notifications now to
@bakura10 bakura10 Merge branch 'form/create-empty-option' of in…
…to form/create-empty-option

@weierophinney weierophinney and 1 other commented on an outdated diff Sep 10, 2012

@@ -96,6 +104,10 @@ public function setOptions($options)
+ if (isset($this->options['create_empty_option'])) {
+ $this->setShouldCreateEmptyOption($this->options['create_empty_option']);

weierophinney Sep 10, 2012


I don't see this method in the class, and looking at the tests, this line would never get exercised. Can you please test this permutation?


bakura10 Sep 10, 2012


Oops. My mistake !

weierophinney merged commit a4ddea4 into zendframework:master Sep 10, 2012

1 check passed

default The Travis build passed

weierophinney commented Sep 10, 2012

Excellent, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment