feat(front/Form): allow overriding onSubmit function
This commit is contained in:
parent
7a49e47ae7
commit
0e0e633e08
@ -19,11 +19,11 @@
|
|||||||
const formId = nextAvailableFormId++;
|
const formId = nextAvailableFormId++;
|
||||||
setContext('formId', formId);
|
setContext('formId', formId);
|
||||||
|
|
||||||
function handleSubmit(e) {
|
export let onSubmit = function(e) {
|
||||||
if (confirm && !window.confirm(confirm)) {
|
if (confirm && !window.confirm(confirm)) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
@ -38,7 +38,7 @@
|
|||||||
}
|
}
|
||||||
</style>
|
</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/>
|
<CsrfTokenField/>
|
||||||
<slot/>
|
<slot/>
|
||||||
<div class="form-controls">
|
<div class="form-controls">
|
||||||
|
Loading…
Reference in New Issue
Block a user