diff --git a/frappe/templates/generators/web_form.html b/frappe/templates/generators/web_form.html index f776248c76..e4f783420b 100644 --- a/frappe/templates/generators/web_form.html +++ b/frappe/templates/generators/web_form.html @@ -436,15 +436,13 @@ frappe.ready(function() { // change section $('.btn-change-section, .slide-progress .icon-fixed-width').on('click', function() { var idx = $(this).attr('data-idx'); - show_slide(idx); - if(frappe.form_dirty && !frappe.is_read_only) { - try { - save(); - } catch(e) { - // pass + if(!frappe.form_dirty || frappe.is_read_only) { + show_slide(idx); + } else { + if(save()!==false) { + show_slide(idx); } } - return false; }); show_slide = function(idx) { @@ -599,16 +597,14 @@ frappe.ready(function() { if(frappe.file_reading) { window.saving = false; frappe.msgprint(__("Uploading files please wait for a few seconds.")); - throw 'reading files'; - return; + return false; } var data = get_data(); - if(frappe.allow_incomplete && frappe.mandatory_missing.length) { + if((!frappe.allow_incomplete || for_payment) && frappe.mandatory_missing.length) { window.saving = false; show_mandatory_missing(); - throw 'mandatory missing'; - return; + return false; } frappe.call({ @@ -646,6 +642,7 @@ frappe.ready(function() { window.saving = false; } }); + return true; } function show_mandatory_missing() { diff --git a/frappe/templates/web.html b/frappe/templates/web.html index e89d639b8f..ae059cfca7 100644 --- a/frappe/templates/web.html +++ b/frappe/templates/web.html @@ -13,7 +13,7 @@
-
+
{% if not no_breadcrumbs and parents %} {% endif %} +
+
{% block header %}{% endblock %}
diff --git a/frappe/website/doctype/web_form/web_form.py b/frappe/website/doctype/web_form/web_form.py index 73957b53ca..08b4ddcbfe 100644 --- a/frappe/website/doctype/web_form/web_form.py +++ b/frappe/website/doctype/web_form/web_form.py @@ -306,12 +306,12 @@ def get_context(context): '''Validate mandatory web form fields''' missing = [] for f in self.web_form_fields: - if f.reqd and doc.get(f.fieldname) in (None, []): + if f.reqd and doc.get(f.fieldname) in (None, [], ''): missing.append(f) if missing: frappe.throw(_('Mandatory Information missing:') + '

' - + '
'.join([d.label for d in missing])) + + '
'.join(['{0} ({1})'.format(d.label, d.fieldtype) for d in missing])) @frappe.whitelist(allow_guest=True)