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 5fa02e81dbb80cc80c0b1a47075504722d724e7d..36fdb29c1f2a6bced91d0bd0f017191fb6ef712c 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 @@ -77,24 +77,17 @@ function clickSaveButton(act) {\n // else if no element have autofocus class, the first element wich is not the\n // search field will get the focus. This is generaly the title input text of\n // a view\n -\n function autoFocus() {\n - var inputs = document.getElementsByTagName("input");\n - var input_to_focus = 0;\n - for (i=0;i<inputs.length;i++) {\n - if (inputs[i].className == "autofocus") {\n - input_to_focus = inputs[i];\n - }\n - }\n - if (input_to_focus != 0) {\n - input_to_focus.focus();\n + var first_autofocus_expr = ".//input[@class=\'autofocus\']"\n + var FIRST_RESULT = XPathResult.FIRST_ORDERED_NODE_TYPE\n +\n + var input = document.evaluate(first_autofocus_expr, document, null, FIRST_RESULT, null).singleNodeValue;\n + if (input) {\n + input.focus();\n }else{\n - for ( var i=0; i<inputs.length; i++ ){\n - if (inputs[i].getAttribute("type") == "text" && inputs[i].getAttribute("name") != "field_your_search_text"){\n - inputs[i].focus();\n - break;\n - }\n - }\n + var first_text_input_expr = ".//input[@type=\'text\'][@name != \'field_your_search_text\']"\n + var first_text_input = document.evaluate(first_text_input_expr, document, null, FIRST_RESULT, null).singleNodeValue;\n + first_text_input.focus();\n }\n }\n \n diff --git a/product/ERP5/bootstrap/erp5_xhtml_style/bt/revision b/product/ERP5/bootstrap/erp5_xhtml_style/bt/revision index 37e6f1741c6beff28585046f1038d9f2377b9514..430faa64e76e7478e4653bc318c717b548aa76e8 100644 --- a/product/ERP5/bootstrap/erp5_xhtml_style/bt/revision +++ b/product/ERP5/bootstrap/erp5_xhtml_style/bt/revision @@ -1 +1 @@ -515 \ No newline at end of file +511 \ No newline at end of file