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

Allow to create empty option in Select #2288

Merged
merged 16 commits into from
Sep 10, 2012

Conversation

bakura10
Copy link
Contributor

@bakura10 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.

@travisbot
Copy link

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

@travisbot
Copy link

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

kuwabarahiroshi and others added 14 commits September 3, 2012 11:06
HTTP response should accept status line with zero length reasen phrase.
…join, Added unit test, fixed typo's in unit test
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, 
Same issue as with zendframework#2293

It passes the value of isset and not the min/step attribute.
@@ -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']);
Copy link
Member

Choose a reason for hiding this comment

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

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oops. My mistake !

@ghost ghost assigned weierophinney Sep 10, 2012
@weierophinney weierophinney merged commit a4ddea4 into zendframework:master Sep 10, 2012
@weierophinney
Copy link
Member

Excellent, thanks!

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.

7 participants