Allow to create empty option in Select #2288

Merged
merged 16 commits into from Sep 10, 2012

Conversation

Projects
None yet
9 participants
Contributor

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.
d2cfcce
@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
ca24ad1
@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, 
9a4571f
@weierophinney weierophinney Merge branch 'patch-1' of https://github.com/gpeltink/zf2 ef90275
@weierophinney weierophinney Merge branch 'master' of https://github.com/kuwabarahiroshi/zf2 b5f1a44
@ralphschindler ralphschindler Merge branch 'hotfix/ZF2-514' of git://github.com/kpieters/zf2 into k…
…pieters-hotfix/ZF2-514
294ad43
@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.
156cfc0
@bakura10 bakura10 Add unit test ebf819e
@weierophinney weierophinney Merge branch 'prg-use-params' of https://github.com/bakura10/zf2 ceeccff
@weierophinney weierophinney Merge branch 'patch-2' of https://github.com/gpeltink/zf2 2db58cf
@Slamdunk Slamdunk Notifications now to #zftalk.dev e02a3b4
@padraic padraic Merge pull request #2302 from Slamdunk/patch-1
Notifications now to #zftalk.dev
bcc6ee9
@bakura10 bakura10 Merge branch 'form/create-empty-option' of github.com:bakura10/zf2 in…
…to form/create-empty-option
7a86ea5

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

library/Zend/Form/Element/Select.php
@@ -96,6 +104,10 @@ public function setOptions($options)
$this->setValueOptions($this->options['options']);
}
+ if (isset($this->options['create_empty_option'])) {
+ $this->setShouldCreateEmptyOption($this->options['create_empty_option']);
@weierophinney

weierophinney Sep 10, 2012

Owner

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

bakura10 Sep 10, 2012

Contributor

Oops. My mistake !

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

1 check passed

default The Travis build passed
Details
Owner

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