Closed claytongf closed 1 month ago
@claytongf Hi,
I can assume that after submitting this component has been completely updated and it needs to be reinitialized. You can use the function HSStaticMethods.autoInit(['select'])
which should be called after submitting.
Hi @olegpix I've tried to add the function as your instructions but it's not working
<button id="submit"
class="font-medium text-white bg-blue-600 border border-transparent rounded-md shadow-sm">Save
</button>
<script>
document.getElementById("submit").addEventListener("click", function() {
HSStaticMethods.autoInit(['select']);
});
</script>
Is this the correct approach?
@claytongf Hi, Yes, that is correct. But maybe the function should be called after the error occurs, not immediately upon clicking. I can't see the form in the link you provided (https://www.livewire.com/). What steps should I follow to see the form you provided in the screenshots?
Summary
The select disappears after submiting a form with validation errors.
Steps to Reproduce
Using: "tailwindcss": "^3.1.0", "preline": "^2.3.0" "php": "^8.2", "livewire/livewire": "^3.4",
I've created a
Here is the code
select.blade.php
the form code
Demo Link
https://livewire.com
Expected Behavior
The select cannot disappears after submitting the form.
Actual Behavior
The select disappears after submitting the form.
Screenshots