Autofocus first field as settings option (#536)
Co-authored-by: Julien Nahum <julien@nahum.net>
This commit is contained in:
@@ -185,6 +185,11 @@
|
||||
label="Auto save form response"
|
||||
help="Will save data in browser, if user not submit the form then next time will auto prefill last entered data"
|
||||
/>
|
||||
<ToggleSwitchInput
|
||||
name="auto_focus"
|
||||
:form="form"
|
||||
label="Auto focus first input on page"
|
||||
/>
|
||||
</editor-options-panel>
|
||||
</template>
|
||||
|
||||
|
||||
1
client/composables/forms/initForm.js
vendored
1
client/composables/forms/initForm.js
vendored
@@ -22,6 +22,7 @@ export const initForm = (defaultValue = {}, withDefaultProperties = false) => {
|
||||
closed_text:
|
||||
"This form has now been closed by its owner and does not accept submissions anymore.",
|
||||
auto_save: true,
|
||||
auto_focus: true,
|
||||
border_radius: 'small',
|
||||
size: 'md',
|
||||
|
||||
|
||||
@@ -161,7 +161,7 @@ onMounted(() => {
|
||||
console.error('Error appending custom code', e)
|
||||
}
|
||||
}
|
||||
if (!isIframe) focusOnFirstFormElement()
|
||||
if (!isIframe && form.value?.auto_focus) focusOnFirstFormElement()
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user