Commit aaed70ab authored by Fabien Morin's avatar Fabien Morin

test if text input exists before give it the focus. This prevent the javascipt...

test if text input exists before give it the focus. This prevent the javascipt to crash when no text input are found on the page.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@20051 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 8269054c
...@@ -87,7 +87,9 @@ function autoFocus() {\n ...@@ -87,7 +87,9 @@ function autoFocus() {\n
}else{\n }else{\n
var first_text_input_expr = ".//input[@type=\'text\'][@name != \'field_your_search_text\']"\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 var first_text_input = document.evaluate(first_text_input_expr, document, null, FIRST_RESULT, null).singleNodeValue;\n
first_text_input.focus();\n if (first_text_input){\n
first_text_input.focus();\n
}\n
}\n }\n
}\n }\n
\n \n
......
516 517
\ No newline at end of file \ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment