From 5a539802d8cbb781279c20dd6c557f82e91b3fa9 Mon Sep 17 00:00:00 2001
From: mcramer <m.cramer@pixcept.de>
Date: Mon, 27 Aug 2012 13:36:19 -0400
Subject: [PATCH] Fixed: Some templates used changeTab in a way that was not compatible with the new options to discard changes on changeTab

---
 interface/web/js/scrigo.js.php |   13 ++++++++-----
 1 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/interface/web/js/scrigo.js.php b/interface/web/js/scrigo.js.php
index e1ef2c3..4146127 100644
--- a/interface/web/js/scrigo.js.php
+++ b/interface/web/js/scrigo.js.php
@@ -306,11 +306,14 @@
 	//document.forms[0].next_tab.value = tab;
 	document.pageForm.next_tab.value = tab;
     
-    var id = document.pageForm.id.value;
+    var idel = jQuery('form#pageForm').find('[name="id"]');
+    var id = null;
+    if(idel.length > 0) id = idel.val();
     if(tabChangeDiscard == 'y') {
-        if(id && (pageFormChanged == false || window.confirm(tabChangeDiscardTxt))) {
+        if((idel.length < 1 || id) && (pageFormChanged == false || window.confirm(tabChangeDiscardTxt))) {
             var next_tab = tab;
-            loadContent(target, {'next_tab': next_tab, 'id': id});
+            if(id) loadContent(target, {'next_tab': next_tab, 'id': id});
+            else loadContent(target, {'next_tab': next_tab});
         } else {
             return false;
         }
@@ -320,8 +323,8 @@
                 submitForm('pageForm', target);
             } else {
                 var next_tab = tab;
-                var id = document.pageForm.id.value;
-                loadContent(target, {'next_tab': next_tab, 'id': id});
+                if(id) loadContent(target, {'next_tab': next_tab, 'id': id});
+                else loadContent(target, {'next_tab': next_tab});
             }
         } else {
             submitForm('pageForm',target);

--
Gitblit v1.9.1