Skip to content

Commit 59f1240

Browse files
committed
Merge pull request #63 from rumeau/patch-1
Modify Placeholder to not send data
2 parents fb7693c + 0f4473f commit 59f1240

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

src/FormBuilder.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -642,6 +642,7 @@ protected function placeholderOption($display, $selected)
642642
$selected = $this->getSelectedValue(null, $selected);
643643

644644
$options = compact('selected');
645+
$options['value'] = '';
645646

646647
return '<option' . $this->html->attributes($options) . '>' . e($display) . '</option>';
647648
}

tests/FormBuilderTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -322,15 +322,15 @@ public function testFormWithOptionalPlaceholder()
322322
null,
323323
['placeholder' => 'Select One...']
324324
);
325-
$this->assertEquals($select, '<select name="size"><option selected="selected">Select One...</option><option value="L">Large</option><option value="S">Small</option></select>');
325+
$this->assertEquals($select, '<select name="size"><option selected="selected" value="">Select One...</option><option value="L">Large</option><option value="S">Small</option></select>');
326326

327327
$select = $this->formBuilder->select(
328328
'size',
329329
['L' => 'Large', 'S' => 'Small'],
330330
'L',
331331
['placeholder' => 'Select One...']
332332
);
333-
$this->assertEquals($select, '<select name="size"><option>Select One...</option><option value="L" selected="selected">Large</option><option value="S">Small</option></select>');
333+
$this->assertEquals($select, '<select name="size"><option value="">Select One...</option><option value="L" selected="selected">Large</option><option value="S">Small</option></select>');
334334
}
335335

336336
public function testFormSelectYear()

0 commit comments

Comments
 (0)