don't route to success message for the website user

This commit is contained in:
Manas Solanki 2017-09-13 18:59:52 +05:30
parent 57730794b6
commit f9988fafe9
2 changed files with 18 additions and 7 deletions

View file

@ -616,7 +616,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
"description": "Message to be displayed on successful completion",
"description": "Message to be displayed on successful completion (only for Guest users)",
"fieldname": "success_message",
"fieldtype": "Text",
"hidden": 0,
@ -646,7 +646,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
"description": "Go to this url after completing the form.",
"description": "Go to this URL after completing the form (only for Guest users)",
"fieldname": "success_url",
"fieldtype": "Data",
"hidden": 0,
@ -1177,7 +1177,7 @@
"issingle": 0,
"istable": 0,
"max_attachments": 0,
"modified": "2017-05-15 18:00:12.750448",
"modified": "2017-09-13 18:55:07.031224",
"modified_by": "Administrator",
"module": "Website",
"name": "Web Form",

View file

@ -280,10 +280,14 @@ frappe.ready(function() {
callback: function(data) {
if(!data.exc) {
frappe.doc_name = data.message;
$form.addClass("hide");
$(".comments, .introduction, .page-head").addClass("hide");
scroll(0, 0);
set_message(frappe.success_link, true);
if(!frappe.login_required) {
show_sucess_message()
}
if(frappe.is_new && frappe.login_required) {
// reload page (with ID)
window.location.href = window.location.pathname + "?name=" + frappe.doc_name;
}
if(for_payment && data.message) {
// redirect to payment
@ -300,6 +304,13 @@ frappe.ready(function() {
return true;
}
function show_sucess_message() {
$form.addClass("hide");
$(".comments, .introduction, .page-head").addClass("hide");
scroll(0, 0);
set_message(frappe.success_link, true);
}
function show_mandatory_missing() {
var text = [], last_section = null;
frappe.mandatory_missing.forEach(function(d) {