First LiveWire project and I’m rebuilding an app in LW & Alpine for a client and I need to match their functionality exactly. They currently have a form that, when the button is pressed, changes state (text basically changes from Submit to Loading), which I have working fine. However, if there are any form errors, I haven’t found the proper way to pass those through. So it comes back with errors, but the button state is still ‘sending’. How can I detect the presence of errors, beyond the initial page load?
This is the simplified current setup. I stripped out classes and non-essentials.
```<div
x-data="{ sending: false }">
<button type="submit"
@click="sending = true"
:disabled="sending">
<span x-show="!sending">Submit</span>
<span x-show="sending">Sending...</span>
</button>
</div>```
I’ve tried to use x-init to pass through count($errors)
, but of course it’s always 0. Any help or guidance in the right direction would be great. Thanks!