From 45aaec05c4825d5993c2fcf16d5c2713bf18ca0a Mon Sep 17 00:00:00 2001
From: Kazuhiko Shiozaki <kazuhiko@nexedi.com>
Date: Thu, 10 Jun 2010 14:16:08 +0000
Subject: [PATCH] 2010-06-10 kazuhiko * Typing Enter key in listbox search
 fields invokes Base_doSelect instead of the page's form action.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@36228 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 .../ListBox_asStandardHTML.xml                |  3 ++-
 .../portal_skins/erp5_xhtml_style/erp5.js.xml | 21 ++++++++++++-------
 .../bootstrap/erp5_xhtml_style/bt/change_log  |  3 +++
 .../bootstrap/erp5_xhtml_style/bt/revision    |  2 +-
 4 files changed, 19 insertions(+), 10 deletions(-)

diff --git a/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/ListBox_asStandardHTML.xml b/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/ListBox_asStandardHTML.xml
index 3776d7ebd7..5bbfe27f5c 100644
--- a/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/ListBox_asStandardHTML.xml
+++ b/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/ListBox_asStandardHTML.xml
@@ -233,7 +233,8 @@
                       tal:replace="structure python: search_field.render(value = param, key = alias)" />\n
                     <tal:block tal:condition="python: search_field is None">\n
                       <input tal:condition="not: is_gadget_mode" name="id" size="8" value=""\n
-                        tal:attributes="name alias; value param" style="width: 100%" />\n
+                        tal:attributes="name alias; value param" style="width: 100%"\n
+                        onkeypress="submitFormOnEnter(event, this.form, \'Base_doSelect\');" />\n
                       <input tal:condition="is_gadget_mode" \n
                         tal:define ="params python: {alias:\'this.value\'};"\n
                         size="8" type="textarea" \n
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 07d0252aed..95f53be4f0 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
@@ -277,14 +277,19 @@ var addOnChangeEventHandler = function() {\n
         if (nodes[j].nodeName == "DIV" && (\n
             nodes[j].getAttribute("class") == "listbox" ||\n
             nodes[j].getAttribute("class") == "MatrixContent")) {\n
-\n
-           inputs = nodes[j].getElementsByTagName(\'input\');\n
-           for (k=0; k<inputs.length; k++){\n
-             if (inputs[k].getAttribute("type") != "hidden" &&\n
-                 !inputs[k].onchange) {\n
-               inputs[k].onchange = function() { changed = true; };\n
-             }\n
-           }\n
+          trs = nodes[j].getElementsByTagName(\'td\');\n
+          for (k=0; k<trs.length; k++){\n
+            if (trs[k].getAttribute("class") == "listbox_search_line") {\n
+              continue;\n
+            }\n
+            inputs = trs[k].getElementsByTagName(\'input\');\n
+            for (l=0; l<inputs.length; l++){\n
+              if (inputs[l].getAttribute("type") != "hidden" &&\n
+                  !inputs[l].onchange) {\n
+                inputs[l].onchange = function() { changed = true; };\n
+              }\n
+            }\n
+          }\n
         }\n
       }\n
     }\n
diff --git a/product/ERP5/bootstrap/erp5_xhtml_style/bt/change_log b/product/ERP5/bootstrap/erp5_xhtml_style/bt/change_log
index aa958e0d5a..be32d26b26 100644
--- a/product/ERP5/bootstrap/erp5_xhtml_style/bt/change_log
+++ b/product/ERP5/bootstrap/erp5_xhtml_style/bt/change_log
@@ -1,3 +1,6 @@
+2010-06-10 kazuhiko
+* Typing Enter key in listbox search fields invokes Base_doSelect instead of the page's form action.
+
 2010-05-28 yo
 * Make it possible to customize the behavior after a new content is added.
 
diff --git a/product/ERP5/bootstrap/erp5_xhtml_style/bt/revision b/product/ERP5/bootstrap/erp5_xhtml_style/bt/revision
index 397787a80e..4d190201b6 100644
--- a/product/ERP5/bootstrap/erp5_xhtml_style/bt/revision
+++ b/product/ERP5/bootstrap/erp5_xhtml_style/bt/revision
@@ -1 +1 @@
-949
\ No newline at end of file
+950
\ No newline at end of file
-- 
2.30.9