From 739754214ed79dfda1d5ee69dfca3d9bc08734be Mon Sep 17 00:00:00 2001
From: Ivan Tyagov <ivan@nexedi.com>
Date: Wed, 30 Jun 2010 08:32:23 +0000
Subject: [PATCH] Disable other form elements having same html tag and name
 attribut if elemet explicitly passed. This way is some rare cases where in
 one form ERP5 page multiple such elements exists we can still send form with
 correct data.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@36714 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 .../portal_skins/erp5_xhtml_style/erp5.js.xml             | 8 +++++++-
 product/ERP5/bootstrap/erp5_xhtml_style/bt/revision       | 2 +-
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/erp5.js.xml b/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/erp5.js.xml
index 95f53be4f0..3e98cb5ec0 100644
--- a/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/erp5.js.xml
+++ b/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/erp5.js.xml
@@ -174,7 +174,7 @@ function fixLeftRightHeightAndFocus(fix_height) {\n
 // and modify respective main form action\n
 // if clear_changed_flag is set to true, changed will be set to false, so no\n
 // warning message about unsaved changes will be displayed\n
-function submitFormOnEnter(event, form, method_name, clear_changed_flag){\n
+function submitFormOnEnter(event, form, method_name, clear_changed_flag, element){\n
   if (clear_changed_flag == null){\n
     clear_changed_flag = false;\n
   }\n
@@ -186,6 +186,12 @@ function submitFormOnEnter(event, form, method_name, clear_changed_flag){\n
     if (clear_changed_flag==true) {\n
       changed = false;\n
     }\n
+    if(element!=null){\n
+      // disable other form elements having same name attribute\n
+      forEach(getElementsByTagAndClassName(element.tagName), function (input){\n
+        if((input.name == element.name) && (input!=element)){input.disabled = true;}\n
+      });\n
+     }\n
     form.submit();\n
   }\n
 }\n
diff --git a/product/ERP5/bootstrap/erp5_xhtml_style/bt/revision b/product/ERP5/bootstrap/erp5_xhtml_style/bt/revision
index 0c8ddea6ab..36c9eca540 100644
--- a/product/ERP5/bootstrap/erp5_xhtml_style/bt/revision
+++ b/product/ERP5/bootstrap/erp5_xhtml_style/bt/revision
@@ -1 +1 @@
-955
\ No newline at end of file
+957
\ No newline at end of file
-- 
2.30.9