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 @@
- {% if introduction_text %}
+ {% if is_new and introduction_text %}
{{ introduction_text }}
{% endif %}
diff --git a/frappe/website/doctype/web_form/test_records.json b/frappe/website/doctype/web_form/test_records.json
index 080217e8f8..62dea7446a 100644
--- a/frappe/website/doctype/web_form/test_records.json
+++ b/frappe/website/doctype/web_form/test_records.json
@@ -2,6 +2,7 @@
"allow_comments": 0,
"allow_edit": 1,
"allow_multiple": 1,
+ "show_list": 1,
"doc_type": "Event",
"docstatus": 0,
"doctype": "Web Form",
diff --git a/frappe/website/doctype/web_form/web_form.json b/frappe/website/doctype/web_form/web_form.json
index f9ebb3a4e7..158bb40ae2 100644
--- a/frappe/website/doctype/web_form/web_form.json
+++ b/frappe/website/doctype/web_form/web_form.json
@@ -36,7 +36,6 @@
"button_label",
"column_break_29",
"success_message",
- "route_to_success_link",
"success_url",
"list_settings_tab",
"list_setting_message",
@@ -101,13 +100,6 @@
"fieldtype": "Check",
"label": "Login Required"
},
- {
- "default": "0",
- "depends_on": "eval:doc.login_required",
- "fieldname": "route_to_success_link",
- "fieldtype": "Check",
- "label": "Route to Success Link"
- },
{
"default": "0",
"depends_on": "login_required",
@@ -211,7 +203,6 @@
"label": "Success Message"
},
{
- "depends_on": "route_to_success_link",
"description": "Go to this URL after completing the form",
"fieldname": "success_url",
"fieldtype": "Data",
@@ -325,7 +316,7 @@
"icon": "icon-edit",
"is_published_field": "published",
"links": [],
- "modified": "2022-07-24 20:29:23.059834",
+ "modified": "2022-07-27 18:19:10.748079",
"modified_by": "Administrator",
"module": "Website",
"name": "Web Form",
diff --git a/frappe/website/doctype/web_form/web_form.py b/frappe/website/doctype/web_form/web_form.py
index 95f58e12fd..eee7827500 100644
--- a/frappe/website/doctype/web_form/web_form.py
+++ b/frappe/website/doctype/web_form/web_form.py
@@ -172,6 +172,7 @@ def get_context(context):
if (
frappe.session.user != "Guest"
+ and self.login_required
and not self.allow_multiple
and not frappe.form_dict.name
and not frappe.form_dict.is_list
@@ -183,7 +184,7 @@ def get_context(context):
# Show new form when
# - User is Guest
# - Login not required
- route_to_new = frappe.session.user == "Guest" and not self.login_required
+ route_to_new = frappe.session.user == "Guest" or not self.login_required
if not frappe.form_dict.is_new and route_to_new:
frappe.redirect(f"/{self.route}/new")
@@ -245,7 +246,7 @@ def get_context(context):
if self.breadcrumbs:
context.parents = frappe.safe_eval(self.breadcrumbs, {"_": _})
- if frappe.form_dict.is_new:
+ if self.show_list and frappe.form_dict.is_new:
context.title = _("New {0}").format(context.title)
context.has_header = (frappe.form_dict.name or frappe.form_dict.is_new) and (
@@ -287,7 +288,7 @@ def get_context(context):
"route": f"{self.route}/{context.doc_name}",
}
)
- context.title = _("Edit")
+ context.title = _("Editing {0}").format(context.title)
context.reference_doc.add_seen()
context.reference_doctype = context.reference_doc.doctype
context.reference_name = context.reference_doc.name