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; return;
} }
evt.preventDefault(); evt.preventDefault();
that.onSubmit(); that.onSubmit({ ...evt, prevent: false });
} }
}); });
}, },

View File

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

View File

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

View File

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