Skip to content

Beautiful Open-Source Form Builder

Fix the form pagination

Julien Nahum1f558dbcbb71
diff --git a/client/components/forms/components/VSwitch.vue b/client/components/forms/components/VSwitch.vue
index ce906f38a..719aef8e4 100644
--- a/client/components/forms/components/VSwitch.vue
+++ b/client/components/forms/components/VSwitch.vue
@@ -13,10 +13,10 @@ const { modelValue, disabled } = defineProps({
modelValue: { type: Boolean, default: false },
disabled: { type: Boolean, default: false }
})
-const emit = defineEmits(['update:modelValue'])
+const emits = defineEmits(['update:modelValue'])
const onClick = () => {
if (disabled) return
- emit('update:modelValue', !modelValue)
+ emits('update:modelValue', !modelValue)
}
</script>
diff --git a/client/components/open/forms/OpenForm.vue b/client/components/open/forms/OpenForm.vue
index 206880838..644730329 100644
--- a/client/components/open/forms/OpenForm.vue
+++ b/client/components/open/forms/OpenForm.vue
@@ -48,7 +48,7 @@
<slot v-if="isLastPage" name="submit-btn" :submitForm="submitForm" />
<open-form-button v-else native-type="button" :color="form.color" :theme="theme" class="mt-2 px-8 mx-1"
- @click="nextPage"
+ @click.stop="nextPage"
>
{{ currentFieldsPageBreak.next_btn_text }}
</open-form-button>
@@ -171,6 +171,7 @@ export default {
* Returns the page break block for the current group of fields
*/
currentFieldsPageBreak () {
+ // Last block from current group
const block = this.currentFields[this.currentFields.length - 1]
if (block && block.type === 'nf-page-break') return block
return null
@@ -376,11 +377,13 @@ export default {
this.dataForm = useForm(formData)
},
previousPage () {
+ console.log('preivousPage', this.currentFieldGroupIndex)
this.currentFieldGroupIndex -= 1
window.scrollTo({ top: 0, behavior: 'smooth' })
return false
},
nextPage () {
+ console.log('nextPage',this.currentFieldGroupIndex)
this.currentFieldGroupIndex += 1
window.scrollTo({ top: 0, behavior: 'smooth' })
return false
diff --git a/client/components/open/forms/OpenFormButton.vue b/client/components/open/forms/OpenFormButton.vue
index 915cebb78..56a3d9a70 100644
--- a/client/components/open/forms/OpenFormButton.vue
+++ b/client/components/open/forms/OpenFormButton.vue
@@ -1,7 +1,6 @@
<template>
<button :type="nativeType" :disabled="loading?true:null" :class="`py-${sizes['p-y']} px-${sizes['p-x']} text-${sizes['font']} ${theme.Button.body}`" :style="buttonStyle"
- class="btn" @click="$emit('click',$event)"
- >
+ class="btn">
<template v-if="!loading">
<slot />
</template>
diff --git a/client/components/open/forms/OpenFormField.vue b/client/components/open/forms/OpenFormField.vue
index 8c5e02ad4..a863160a7 100644
--- a/client/components/open/forms/OpenFormField.vue
+++ b/client/components/open/forms/OpenFormField.vue
@@ -55,7 +55,7 @@
/>
<template v-else>
<div v-if="field.type === 'nf-text' && field.content" :id="field.id" :key="field.id"
- class="nf-text w-full px-2 mb-3" :class="[getFieldAlignClasses(field)]"
+ class="nf-text w-full mb-3" :class="[getFieldAlignClasses(field)]"
v-html="field.content"
/>
<div v-if="field.type === 'nf-code' && field.content" :id="field.id" :key="field.id"