From 9e8c88ce07c39d4e2ee147b5884908ad5bdf8ffd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20P=C3=A9ters?= Date: Fri, 30 Apr 2021 15:44:51 +0200 Subject: [PATCH] backoffice: apply form js to quick form preview (#53628) --- wcs/admin/forms.py | 1 + wcs/qommon/static/js/qommon.forms.js | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/wcs/admin/forms.py b/wcs/admin/forms.py index 293608ee4..fa61d58e7 100644 --- a/wcs/admin/forms.py +++ b/wcs/admin/forms.py @@ -1138,6 +1138,7 @@ class FormDefPage(Directory): def get_preview(self): form = Form(action='#', use_tokens=False) + form.attrs['data-backoffice-preview'] = 'on' on_page = 0 for i, field in enumerate(self.formdef.fields): field.id = i diff --git a/wcs/qommon/static/js/qommon.forms.js b/wcs/qommon/static/js/qommon.forms.js index 17db33daf..38deb44aa 100644 --- a/wcs/qommon/static/js/qommon.forms.js +++ b/wcs/qommon/static/js/qommon.forms.js @@ -335,7 +335,7 @@ $(function() { } - add_js_behaviours($('form[data-live-url]')); + add_js_behaviours($('form[data-live-url], form[data-backoffice-preview]')); // Form with error const first_widget_with_error = document.querySelector('.widget-with-error');