Commit 5d6661d0 authored by Sebastien Robin's avatar Sebastien Robin

make extensible parallel list field working even inside a listbox

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@39088 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 50816b84
...@@ -58,9 +58,14 @@ $(function() {\n ...@@ -58,9 +58,14 @@ $(function() {\n
// Make the parallel list field adding more elements automatically.\n // Make the parallel list field adding more elements automatically.\n
$(\'.input:has(.extensible_parallel_list_field)\').change(function(event) {\n $(\'.input:has(.extensible_parallel_list_field)\').change(function(event) {\n
event.preventDefault();\n event.preventDefault();\n
var select_element = $(this)\n var select_element = $(event.target)\n
var add_element = true;\n var add_element = true;\n
var to_clone_element = select_element\n
var parent = select_element.parent()\n var parent = select_element.parent()\n
if (parent[0].nodeName == \'DIV\') {\n
to_clone_element = parent\n
parent = parent.parent()\n
}\n
var select_list = parent.find(\'select\')\n var select_list = parent.find(\'select\')\n
for(var x = select_list.length; x;) {\n for(var x = select_list.length; x;) {\n
current_select = select_list[--x]\n current_select = select_list[--x]\n
...@@ -71,8 +76,8 @@ $(function() {\n ...@@ -71,8 +76,8 @@ $(function() {\n
}\n }\n
if (add_element) {\n if (add_element) {\n
parent.append(jQuery(\'<label>&nbsp;</label>\'))\n parent.append(jQuery(\'<label>&nbsp;</label>\'))\n
var cloned_element = $(select_element).clone(true)\n var cloned_element = to_clone_element.clone(true)\n
cloned_element.find(\'select\')[0].selectedIndex = 0\n cloned_element[0].selectedIndex = 0\n
cloned_element.appendTo(parent)\n cloned_element.appendTo(parent)\n
parent.append(jQuery(\'<p class="clear">\'))\n parent.append(jQuery(\'<p class="clear">\'))\n
}\n }\n
......
1 3
\ 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