@@ -436,15 +436,13 @@ frappe.ready(function() { | |||||
// change section | // change section | ||||
$('.btn-change-section, .slide-progress .icon-fixed-width').on('click', function() { | $('.btn-change-section, .slide-progress .icon-fixed-width').on('click', function() { | ||||
var idx = $(this).attr('data-idx'); | 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) { | show_slide = function(idx) { | ||||
@@ -599,16 +597,14 @@ frappe.ready(function() { | |||||
if(frappe.file_reading) { | if(frappe.file_reading) { | ||||
window.saving = false; | window.saving = false; | ||||
frappe.msgprint(__("Uploading files please wait for a few seconds.")); | frappe.msgprint(__("Uploading files please wait for a few seconds.")); | ||||
throw 'reading files'; | |||||
return; | |||||
return false; | |||||
} | } | ||||
var data = get_data(); | 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; | window.saving = false; | ||||
show_mandatory_missing(); | show_mandatory_missing(); | ||||
throw 'mandatory missing'; | |||||
return; | |||||
return false; | |||||
} | } | ||||
frappe.call({ | frappe.call({ | ||||
@@ -646,6 +642,7 @@ frappe.ready(function() { | |||||
window.saving = false; | window.saving = false; | ||||
} | } | ||||
}); | }); | ||||
return true; | |||||
} | } | ||||
function show_mandatory_missing() { | function show_mandatory_missing() { | ||||
@@ -13,7 +13,7 @@ | |||||
<div class="{% if show_sidebar %}page-content with-sidebar col-sm-9{% else %} page-content col-sm-12 {% endif %}"> | <div class="{% if show_sidebar %}page-content with-sidebar col-sm-9{% else %} page-content col-sm-12 {% endif %}"> | ||||
<div class="page-content-wrapper"> | <div class="page-content-wrapper"> | ||||
<div class="row page-head"> | <div class="row page-head"> | ||||
<div class="col-sm-8 col-xs-6"> | |||||
<div class='col-sm-12'> | |||||
{% if not no_breadcrumbs and parents %} | {% if not no_breadcrumbs and parents %} | ||||
<div class="page-breadcrumbs"> | <div class="page-breadcrumbs"> | ||||
{% block breadcrumbs %} | {% block breadcrumbs %} | ||||
@@ -21,6 +21,8 @@ | |||||
{% endblock %} | {% endblock %} | ||||
</div> | </div> | ||||
{% endif %} | {% endif %} | ||||
</div> | |||||
<div class="col-sm-8 col-xs-6"> | |||||
{% block header %}{% endblock %} | {% block header %}{% endblock %} | ||||
</div> | </div> | ||||
<div class="col-sm-4 col-xs-6"> | <div class="col-sm-4 col-xs-6"> | ||||
@@ -306,12 +306,12 @@ def get_context(context): | |||||
'''Validate mandatory web form fields''' | '''Validate mandatory web form fields''' | ||||
missing = [] | missing = [] | ||||
for f in self.web_form_fields: | 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) | missing.append(f) | ||||
if missing: | if missing: | ||||
frappe.throw(_('Mandatory Information missing:') + '<br><br>' | frappe.throw(_('Mandatory Information missing:') + '<br><br>' | ||||
+ '<br>'.join([d.label for d in missing])) | |||||
+ '<br>'.join(['{0} ({1})'.format(d.label, d.fieldtype) for d in missing])) | |||||
@frappe.whitelist(allow_guest=True) | @frappe.whitelist(allow_guest=True) | ||||