What seems to be the problem:
When trying to implement a select box with a “placeholder”, disabled value, it removes the disabled value from displaying as a placeholder.
Steps to Reproduce:
Create a select field with one disabled value for the placeholder, add “wire:model” to the field and it removed the disabled value
Are you using the latest version of Livewire:
Yes, 2.0
Do you have any screenshots or code examples:
Wire:model select field removes disabled option
2 Likes
I’m having the same problem. Did you find a solution?
1 Like
Hi, not as of yet. If you do, please post it here
1 Like
Livewire.hook('message.processed', (message, component) => {
App.select2();
$('.select2').on('change', function () {
@this.comments = $(this).val();
});
})
Anyone figure out a way to get a disabled placeholder to show first on select fields?
This is how I’m currently doing it and it feels wrong…
// Component:
public $lunch = null;
public function mount(){
$this->lunch = 'place_holder';
}
//Blade View:
<select wire:model="lunch">
<option value="place_holder" disabled selected>Choose One</option>
<option value="1">Yes</option>
<option value="0">No</option>
</select>