diff --git a/forms_pro/forms_pro/doctype/form_field/form_field.json b/forms_pro/forms_pro/doctype/form_field/form_field.json index 19df819..3e1e843 100644 --- a/forms_pro/forms_pro/doctype/form_field/form_field.json +++ b/forms_pro/forms_pro/doctype/form_field/form_field.json @@ -37,7 +37,7 @@ "fieldtype": "Select", "in_list_view": 1, "label": "Fieldtype", - "options": "Attach\nData\nNumber\nEmail\nDate\nDate Time\nDate Range\nTime Picker\nPassword\nSelect\nSwitch\nTextarea\nText Editor\nLink\nCheckbox\nRating\nPhone", + "options": "Attach\nData\nNumber\nEmail\nDate\nDate Time\nDate Range\nTime Picker\nPassword\nSelect\nSwitch\nTextarea\nText Editor\nLink\nCheckbox\nRating\nPhone\nTable", "reqd": 1 }, { @@ -81,7 +81,7 @@ "index_web_pages_for_search": 1, "istable": 1, "links": [], - "modified": "2026-01-15 00:41:11.397823", + "modified": "2026-02-11 14:39:48.593350", "modified_by": "Administrator", "module": "Forms Pro", "name": "Form Field", diff --git a/forms_pro/forms_pro/doctype/form_field/form_field.py b/forms_pro/forms_pro/doctype/form_field/form_field.py index ede01f6..f347b6d 100644 --- a/forms_pro/forms_pro/doctype/form_field/form_field.py +++ b/forms_pro/forms_pro/doctype/form_field/form_field.py @@ -36,6 +36,7 @@ class FormField(Document): "Checkbox", "Rating", "Phone", + "Table", ] hidden: DF.Check label: DF.Data diff --git a/forms_pro/hooks.py b/forms_pro/hooks.py index 987832d..1b36b08 100644 --- a/forms_pro/hooks.py +++ b/forms_pro/hooks.py @@ -30,7 +30,7 @@ # include js, css files in header of desk.html # app_include_css = "/assets/forms_pro/css/forms_pro.css" -# app_include_js = "/assets/forms_pro/js/forms_pro.js" +app_include_js = "/assets/forms_pro/js/forms_pro_desk.js" # include js, css files in header of web template # web_include_css = "/assets/forms_pro/css/forms_pro.css" diff --git a/forms_pro/public/js/forms_pro_desk.js b/forms_pro/public/js/forms_pro_desk.js new file mode 100644 index 0000000..ece0063 --- /dev/null +++ b/forms_pro/public/js/forms_pro_desk.js @@ -0,0 +1,21 @@ +// Forms Pro: fix opening Form doctype documents from list view. +// The doctype name "Form" conflicts with the router's "form" view, so path-based +// navigation (/desk/form/docname) is misinterpreted. We patch set_route so that +// when called with a path like "/desk/form/" we use ["Form", "Form", name]. +(function () { + if (typeof frappe === "undefined") return; + + const original_set_route = frappe.set_route; + frappe.set_route = function () { + const args = Array.from(arguments); + if (args.length === 1 && typeof args[0] === "string" && args[0].includes("/")) { + // Path string: e.g. "/desk/form/n8tqgeco1u" or "form/n8tqgeco1u" + // Only match form/ (one segment), not form/view/list etc. + const m = args[0].match(/(?:^\/?(?:desk\/|app\/)?)?form\/([^/#?]+)(?=[#?]|$)/); + if (m) { + return original_set_route.apply(frappe.router, ["Form", "Form", m[1]]); + } + } + return original_set_route.apply(frappe.router, args); + }; +})(); diff --git a/frontend/src/components/RenderField.vue b/frontend/src/components/RenderField.vue index 00fb3c2..b56f979 100644 --- a/frontend/src/components/RenderField.vue +++ b/frontend/src/components/RenderField.vue @@ -1,5 +1,8 @@