File tree Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -104,7 +104,7 @@ public function getControl()
104104 public function validate ()
105105 {
106106 parent ::validate ();
107- if (!$ this ->isDisabled () && $ this ->prompt === FALSE && $ this ->getValue () === NULL ) {
107+ if (!$ this ->isDisabled () && $ this ->prompt === FALSE && $ this ->getValue () === NULL && $ this -> options ) {
108108 $ this ->addError (Nette \Forms \Validator::$ messages [self ::VALID ]);
109109 }
110110 }
Original file line number Diff line number Diff line change @@ -41,6 +41,19 @@ test(function() use ($series) { // Select
4141});
4242
4343
44+ test (function () use ($ series ) { // Empty select
45+ $ _POST = array ('select ' => 'red-dwarf ' );
46+
47+ $ form = new Form ;
48+ $ input = $ form ->addSelect ('select ' );
49+
50+ Assert::true ( $ form ->isValid () );
51+ Assert::same ( NULL , $ input ->getValue () );
52+ Assert::same ( NULL , $ input ->getSelectedItem () );
53+ Assert::false ( $ input ->isFilled () );
54+ });
55+
56+
4457test (function () use ($ series ) { // Select with prompt
4558 $ _POST = array ('select ' => 'red-dwarf ' );
4659
You can’t perform that action at this time.
0 commit comments