From 86f9fbcc71eea8f9ec37ec0aa7b1e8cfe4998d9a Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Sun, 7 Aug 2022 16:40:43 +0530 Subject: [PATCH] fix: Webform Misc Fix (backport #17642) (#17746) Co-authored-by: Shariq Ansari <30859809+shariquerik@users.noreply.github.com> --- cypress/integration/web_form.js | 14 ++++---------- frappe/public/js/frappe/web_form/web_form.js | 6 +++--- .../doctype/web_form/templates/web_form.html | 2 +- frappe/website/doctype/web_form/test_records.json | 1 + frappe/website/doctype/web_form/web_form.json | 11 +---------- frappe/website/doctype/web_form/web_form.py | 7 ++++--- 6 files changed, 14 insertions(+), 27 deletions(-) diff --git a/cypress/integration/web_form.js b/cypress/integration/web_form.js index d69d7ec576..66975ce19b 100644 --- a/cypress/integration/web_form.js +++ b/cypress/integration/web_form.js @@ -20,19 +20,13 @@ context("Web Form", () => { cy.get(".title-area .indicator-pill").contains("Published"); }); - it("Open Web Form (Logged in User)", () => { + it("Open Web Form", () => { cy.visit("/note"); - cy.fill_field("title", "Note 1"); cy.get(".web-form-actions button").contains("Save").click(); - cy.url().should("include", "/note/Note%201"); - - cy.visit("/note"); - cy.url().should("include", "/note/Note%201"); - }); + cy.url().should("include", "/note/new"); - it("Open Web Form (Guest)", () => { cy.request("/api/method/logout"); cy.visit("/note"); @@ -226,8 +220,8 @@ context("Web Form", () => { cy.visit("/note"); cy.url().should("include", "/note/list"); - cy.get('.web-list-table tbody tr[id="Note 1"] .list-col-checkbox').click(); - cy.get('.web-list-table tbody tr[id="Note 2"] .list-col-checkbox').click(); + cy.get('.web-list-table tbody tr[id="Note 1"] .list-col-checkbox input').click(); + cy.get('.web-list-table tbody tr[id="Note 2"] .list-col-checkbox input').click(); cy.get(".web-list-actions button:visible").contains("Delete").click({ force: true }); cy.get(".web-list-actions button").contains("Delete").should("not.be.visible"); diff --git a/frappe/public/js/frappe/web_form/web_form.js b/frappe/public/js/frappe/web_form/web_form.js index daad019bda..034aaf7e06 100644 --- a/frappe/public/js/frappe/web_form/web_form.js +++ b/frappe/public/js/frappe/web_form/web_form.js @@ -293,9 +293,9 @@ export default class WebForm extends frappe.ui.FieldGroup { // validation hack: get_values will check for missing data let doc_values = super.get_values(this.allow_incomplete); - if (!doc_values) return; + if (!doc_values) return false; - if (window.saving) return; + if (window.saving) return false; // TODO: remove this (used for payments app) let for_payment = Boolean(this.accept_payment && !this.doc.paid); @@ -383,6 +383,6 @@ export default class WebForm extends frappe.ui.FieldGroup { } } window.location.href = path; - }, 1000); + }, 3000); } } diff --git a/frappe/website/doctype/web_form/templates/web_form.html b/frappe/website/doctype/web_form/templates/web_form.html index 5b35e6b5b4..313d4040e1 100644 --- a/frappe/website/doctype/web_form/templates/web_form.html +++ b/frappe/website/doctype/web_form/templates/web_form.html @@ -42,7 +42,7 @@