feat(front/Form): allow overriding onSubmit function

This commit is contained in:
Alice Gaudon 2022-02-28 14:43:36 +01:00
parent 7a49e47ae7
commit 0e0e633e08
1 changed files with 3 additions and 3 deletions

View File

@ -19,11 +19,11 @@
const formId = nextAvailableFormId++;
setContext('formId', formId);
function handleSubmit(e) {
export let onSubmit = function(e) {
if (confirm && !window.confirm(confirm)) {
e.preventDefault();
}
}
};
</script>
<style lang="scss">
@ -38,7 +38,7 @@
}
</style>
<form {action} method="POST" id="{formId}-form" on:submit={handleSubmit} enctype={withFiles ? 'multipart/form-data' : undefined}>
<form {action} method="POST" id="{formId}-form" on:submit={onSubmit} enctype={withFiles ? 'multipart/form-data' : undefined}>
<CsrfTokenField/>
<slot/>
<div class="form-controls">