How do I run some code when a specific form's submission is successful? #606
-
Hello! up.on(
'up:form:submit',
'form.my-form',
/**
* @param {Event} event
* @param {HTMLFormElement} $el
*/
function (event, $el) {
// do something
$el.addEventListener('up:fragment:loaded', () => {
$el.reset();
}, { once: true });
}
); ...but, unfortunately, the |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
I'm assuming you're not returning an empty form upon successful submission? You can modify the render options to provide an up.on('up:form:submit', (event, el) => {
const form = el.form
event.renderOptions.onFinished = () => {
form.reset()
}
}) |
Beta Was this translation helpful? Give feedback.
I'm assuming you're not returning an empty form upon successful submission?
You can modify the render options to provide an
onFinished
callback.