From 4350dddc937fe96be5ed378214987952f0b33400 Mon Sep 17 00:00:00 2001 From: Harsh Tandiya Date: Fri, 16 Jan 2026 19:03:54 +0530 Subject: [PATCH 1/3] feat: update form structure to include success page fields * Replaced 'column_break_ixmm' with 'section_break_ngzl' in field order. * Added 'success_title' and 'success_description' fields to the form configuration. * Updated the label for 'column_break_xocw' to 'Success Page'. * Adjusted the modified timestamp in the JSON file. * Enhanced the Python class to include new fields for success title and description. --- forms_pro/forms_pro/doctype/form/form.json | 29 ++++++++++++++++------ forms_pro/forms_pro/doctype/form/form.py | 2 ++ 2 files changed, 23 insertions(+), 8 deletions(-) diff --git a/forms_pro/forms_pro/doctype/form/form.json b/forms_pro/forms_pro/doctype/form/form.json index f145089..a3c7968 100644 --- a/forms_pro/forms_pro/doctype/form/form.json +++ b/forms_pro/forms_pro/doctype/form/form.json @@ -5,7 +5,7 @@ "doctype": "DocType", "engine": "InnoDB", "field_order": [ - "column_break_ixmm", + "section_break_ngzl", "is_published", "route", "column_break_pqae", @@ -14,8 +14,10 @@ "linked_team_id", "settings_section", "login_required", - "column_break_xocw", "allow_incomplete", + "column_break_xocw", + "success_title", + "success_description", "section_break_vdhw", "description", "fields_section", @@ -31,10 +33,6 @@ "label": "Title", "reqd": 1 }, - { - "fieldname": "column_break_ixmm", - "fieldtype": "Column Break" - }, { "fieldname": "linked_doctype", "fieldtype": "Link", @@ -100,7 +98,8 @@ }, { "fieldname": "column_break_xocw", - "fieldtype": "Column Break" + "fieldtype": "Column Break", + "label": "Success Page" }, { "default": "0", @@ -115,12 +114,26 @@ "label": "Linked Team", "options": "FP Team", "reqd": 1 + }, + { + "fieldname": "section_break_ngzl", + "fieldtype": "Section Break" + }, + { + "fieldname": "success_title", + "fieldtype": "Data", + "label": "Success Title" + }, + { + "fieldname": "success_description", + "fieldtype": "Text Editor", + "label": "Success Description" } ], "grid_page_length": 50, "index_web_pages_for_search": 1, "links": [], - "modified": "2025-12-20 20:40:24.219032", + "modified": "2026-01-16 19:02:46.396955", "modified_by": "Administrator", "module": "Forms Pro", "name": "Form", diff --git a/forms_pro/forms_pro/doctype/form/form.py b/forms_pro/forms_pro/doctype/form/form.py index bf3a802..46fe71a 100644 --- a/forms_pro/forms_pro/doctype/form/form.py +++ b/forms_pro/forms_pro/doctype/form/form.py @@ -29,6 +29,8 @@ class Form(Document): login_required: DF.Check metadata: DF.Code | None route: DF.Data | None + success_description: DF.TextEditor | None + success_title: DF.Data | None title: DF.Data # end: auto-generated types From 1e691ce33006be4b669249a5cc6263e4f810bb66 Mon Sep 17 00:00:00 2001 From: Harsh Tandiya Date: Fri, 16 Jan 2026 19:50:21 +0530 Subject: [PATCH 2/3] feat: custom success pages --- forms_pro/api/form.py | 2 + .../builder/sidebar/SettingsSection.vue | 80 ++++++++++++++++++- .../src/components/submission/FormHeader.vue | 3 +- .../components/submission/SuccessSection.vue | 27 ++++++- frontend/src/pages/SubmissionPage.vue | 1 + 5 files changed, 108 insertions(+), 5 deletions(-) diff --git a/forms_pro/api/form.py b/forms_pro/api/form.py index 51425ac..b70421b 100644 --- a/forms_pro/api/form.py +++ b/forms_pro/api/form.py @@ -57,6 +57,8 @@ def get_form(form_id: str) -> dict: "is_published": form.is_published, "allow_incomplete": form.allow_incomplete, "linked_doctype": form.linked_doctype, + "success_title": form.success_title, + "success_description": form.success_description, } diff --git a/frontend/src/components/builder/sidebar/SettingsSection.vue b/frontend/src/components/builder/sidebar/SettingsSection.vue index ad51b11..bbaec7d 100644 --- a/frontend/src/components/builder/sidebar/SettingsSection.vue +++ b/frontend/src/components/builder/sidebar/SettingsSection.vue @@ -1,5 +1,5 @@ diff --git a/frontend/src/components/submission/FormHeader.vue b/frontend/src/components/submission/FormHeader.vue index dc9ced6..6f2c0d4 100644 --- a/frontend/src/components/submission/FormHeader.vue +++ b/frontend/src/components/submission/FormHeader.vue @@ -14,8 +14,7 @@ const submissionFormStore = useSubmissionForm();
diff --git a/frontend/src/components/submission/SuccessSection.vue b/frontend/src/components/submission/SuccessSection.vue index 49f7fa4..a3f7573 100644 --- a/frontend/src/components/submission/SuccessSection.vue +++ b/frontend/src/components/submission/SuccessSection.vue @@ -1,5 +1,24 @@ diff --git a/frontend/src/pages/SubmissionPage.vue b/frontend/src/pages/SubmissionPage.vue index e8db264..382fdfb 100644 --- a/frontend/src/pages/SubmissionPage.vue +++ b/frontend/src/pages/SubmissionPage.vue @@ -6,6 +6,7 @@ import FormRenderer from "@/components/submission/FormRenderer.vue"; import Logo from "@/assets/Logo.vue"; import PageHeader from "@/components/submission/PageHeader.vue"; import PreviousSubmissionSection from "@/components/submission/PreviousSubmissionSection.vue"; +import SuccessSection from "@/components/submission/SuccessSection.vue"; const route = useRoute(); const submissionFormStore = useSubmissionForm(); From f0e788f7b82e5f77407eda2d8313af487d4cfc8b Mon Sep 17 00:00:00 2001 From: Harsh Tandiya Date: Fri, 16 Jan 2026 20:00:50 +0530 Subject: [PATCH 3/3] fix: handle empty html for success description --- .../components/submission/SuccessSection.vue | 24 +++++++++++++------ 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/frontend/src/components/submission/SuccessSection.vue b/frontend/src/components/submission/SuccessSection.vue index a3f7573..a7f231c 100644 --- a/frontend/src/components/submission/SuccessSection.vue +++ b/frontend/src/components/submission/SuccessSection.vue @@ -6,18 +6,28 @@ import { TextEditor } from "frappe-ui"; const submissionFormStore = useSubmissionForm(); +const isEmptyHtml = (html: string | null | undefined): boolean => { + if (!html) return true; + const textContent = html + .replace(/<[^>]*>/g, "") // Remove all HTML tags + .replace(/ /g, " ") // Replace   with space + .replace(/\s+/g, " ") // Normalize whitespace + .trim(); + + return textContent.length === 0; +}; + const successTitle = computed(() => { - if (!submissionFormStore.formResource.data?.success_title) { - return "Form submitted successfully"; - } - return submissionFormStore.formResource.data.success_title; + const title = submissionFormStore.formResource.data?.success_title; + return title; }); const successDescription = computed(() => { - if (!submissionFormStore.formResource.data?.success_description) { - return "Thank you for submitting the form. We will get back to you soon."; + const description = submissionFormStore.formResource.data?.success_description; + if (!description || isEmptyHtml(description)) { + return "

Thank you for submitting the form. We will get back to you soon.

"; } - return submissionFormStore.formResource.data.success_description; + return description; });