-
Notifications
You must be signed in to change notification settings - Fork 44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Flux native select value can't be set to 0
#907
Comments
@gustavosobrinho01 thanks for reporting! Can you try using a value other than |
With another value, it works, but it should also work with 0, as another value does not meet my needs. |
@gustavosobrinho01 yeah agreed, I just wanted to make sure it wasn’t an issue with the first item in the select vs a problem with a 0 value |
I'm experiencing the same issue. This behavior is impacting the filter functionality since the expected numeric value isn't being properly set in the URL parameters. Environment where I reproduced:
|
@gustavosobrinho01 What @joshhanley suspects is probably the case, but I'm curious... If you change your
and your view code to:
does it make any difference? |
@jeffchown the same problem happens. |
Thanks for trying, @gustavosobrinho01 I thought the Looks like it's in @joshhanley 's hands. |
Thanks @gustavosobrinho01 and @jeffchown! I've submitted a PR with a fix. Turns out we had If you use the listbox variant though, it works fine, so that could be a work around for now Volt component I used for testing: <?php
use Livewire\Volt\Component;
new class extends Component {
public $status = '';
};
?>
<div>
<flux:text>Status: {{ $status }}</flux:text>
<select wire:model.live="status">
<option value="">Default</option>
<option value="0">Zero</option>
<option value="1">One</option>
<option value="2">Two</option>
</select>
<flux:select wire:model.live="status">
<flux:option value="">Default</flux:option>
<flux:option value="0">Zero</flux:option>
<flux:option value="1">One</flux:option>
<flux:option value="2">Two</flux:option>
</flux:select>
<flux:select variant="listbox" wire:model.live="status">
<flux:option value="">Default</flux:option>
<flux:option value="0">Zero</flux:option>
<flux:option value="1">One</flux:option>
<flux:option value="2">Two</flux:option>
</flux:select>
</div> |
Thanks, @joshhanley |
0
@joshhanley Thanks, but I didn't find this PR and I ran the update and nothing came. |
@gustavosobrinho01 Josh's PR won't be in the Flux public repo. And, it won't be available via |
Flux version
v1.0.29
Livewire version
v3.5.16
What is the problem?
When using the select as shown in the code and images below, the screen loads with the value 0. When I select the “Ativos” option, the attribute value changes to 1. However, when switching back to the “All Status” option, the value should reset to 0, but as shown in the image, it displays as “Todos+os+Status”.
Code snippets
How do you expect it to work?
I expect the value in the URI to be set to 0, not “Todos+os+Status”.
Please confirm (incomplete submissions will not be addressed)
The text was updated successfully, but these errors were encountered: