fix: refs #8372 allow form submission without prevention
gitea/salix-front/pipeline/pr-dev There was a failure building this commit Details

This commit is contained in:
Jorge Penadés 2025-02-06 09:46:31 +01:00
parent b1d6f9dd9c
commit d047a9deea
4 changed files with 8 additions and 6 deletions

View File

@ -44,7 +44,7 @@ export default {
return;
}
evt.preventDefault();
that.onSubmit();
that.onSubmit({ ...evt, prevent: false });
}
});
},

View File

@ -113,7 +113,7 @@ const defaultButtons = computed(() => ({
color: 'primary',
icon: 'save',
label: 'globals.save',
click: () => myForm.value.submit(),
click: () => myForm.value.onSubmit({ prevent: false }),
type: 'submit',
},
reset: {
@ -202,7 +202,8 @@ async function fetch() {
}
}
async function save() {
async function save({ prevent = true }) {
if (prevent) return;
if ($props.observeFormChanges && !hasChanges.value)
return notify('globals.noChanges', 'negative');
@ -288,7 +289,7 @@ defineExpose({
<QForm
ref="myForm"
v-if="formData"
@submit.prevent="save"
@submit="save"
@reset="reset"
class="q-pa-md"
:style="maxWidth ? 'max-width: ' + maxWidth : ''"

View File

@ -67,7 +67,7 @@ defineExpose({
<QBtn
:label="t('globals.save')"
:title="t('globals.save')"
type="submit"
@click="formModelRef.save({ prevent: false })"
color="primary"
class="q-ml-sm"
:disabled="isLoading"

View File

@ -189,6 +189,7 @@ async function getAmountPaid() {
:url-create="urlCreate"
:mapper="onBeforeSave"
@on-data-saved="onDataSaved"
:prevent-submit="true"
>
<template #form="{ data, validate }">
<span ref="closeButton" class="row justify-end close-icon" v-close-popup>
@ -303,7 +304,7 @@ async function getAmountPaid() {
:label="t('globals.save')"
:loading="formModelRef.isLoading"
color="primary"
@click="formModelRef.save()"
@click="formModelRef.save({ prevent: false })"
/>
</div>
</template>