Submit form on change?

I have a form that consists of only a dropdown list. That’s it.

Is there a way to submit the form when the user changes the dropdown list?

I’d rather not have them also need to click the submit button given the simplicity of the form.

Thanks

As far as I know Livewire only has 3 actions currently, submit, keydown and click. What you want can easily be achieved with Javascript however. If you are using AlpineJS then you should be able to listen for a change event on the select element and either trigger a form submission or directly fire a livewire event.

Haven’t tested this but try adding:

x-on:change="$wire.METHOD()"

Replacing the word METHOD with whatever method you have on your Livewire component class.

If you’re using wire:model (without lazy or defer) though your backend should of been updated as soon as a new select option is selected so you don’t really need a form submission you just need to check for a value existing for that property and conditionally render the form response.

Hope this was helpful. Let me know if I wasn’t clear :slight_smile: