EDIT: So I just changed the button to a standard HTML submit button and it submitted the data, closed the modal, and refreshed the data on the screen.
Pleased but slightly confused.
I am using this tutorial:
which has a submit button in an Alpine JS modal that calls a JS function, even though the form already has an action. I am confused by this.
How do I just use a button that submits the form, using the action in the form tag and closes the modal, by changing this code of the submit button, without calling a “submitForm” script:
<button type="button" class="btn btn-primary" :disabled="!dealtype || !price || !commissionpercentage"
@click="submitForm({dealtype: dealtype ,price: price, commissionpercentage: commissionpercentage}).then(() => {
showModal = false;
success= true;
})">Add</button>