Commit 95fb3bc3 authored by Nicolas Dumazet's avatar Nicolas Dumazet

toggle all children of a delegated node

This fixes display of DateTime fields, that have several inputs.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@36122 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 53a32471
...@@ -160,14 +160,17 @@ function ignoreEvent() { return false; } ...@@ -160,14 +160,17 @@ function ignoreEvent() { return false; }
var class_deletaged_list = GetElementsWithClassName('td','delegated'); var class_deletaged_list = GetElementsWithClassName('td','delegated');
for(var i=0; i<class_deletaged_list.length; i++) { for(var i=0; i<class_deletaged_list.length; i++) {
element = class_deletaged_list[i].childNodes[1]; var disable_children = class_deletaged_list[i].childNodes;
for (var j=0; j<disable_children.length; j++) {
var element = disable_children[j];
if (element.type == 'hidden'){ if (element.type == 'hidden'){
element = element.nextSibling; continue;
} }
element.readOnly = true; element.readOnly = true;
if (element.type == 'checkbox'){ if (element.type == 'checkbox'){
element.onclick = ignoreEvent; element.onclick = ignoreEvent;
} }
}
} }
function toggleFieldState(evt) { function toggleFieldState(evt) {
...@@ -177,9 +180,11 @@ function toggleFieldState(evt) { ...@@ -177,9 +180,11 @@ function toggleFieldState(evt) {
allElements = tr_parent.childNodes; allElements = tr_parent.childNodes;
for (i=0; i<allElements.length; i++) { for (i=0; i<allElements.length; i++) {
if (isClass(allElements[i], 'to_disable')) { if (isClass(allElements[i], 'to_disable')) {
field = allElements[i].childNodes[1]; var disable_children = allElements[i].childNodes;
for (var j=0; j<disable_children.length; j++) {
var field = disable_children[j];
if (field.type == 'hidden'){ if (field.type == 'hidden'){
field = field.nextSibling; continue;
} }
if (field.readOnly){ if (field.readOnly){
field.readOnly = false; field.readOnly = false;
...@@ -195,6 +200,7 @@ function toggleFieldState(evt) { ...@@ -195,6 +200,7 @@ function toggleFieldState(evt) {
} }
} }
} }
}
} }
</script> </script>
<dtml-var manage_page_footer> <dtml-var manage_page_footer>
...@@ -160,14 +160,17 @@ function ignoreEvent() { return false; } ...@@ -160,14 +160,17 @@ function ignoreEvent() { return false; }
var class_deletaged_list = GetElementsWithClassName('td','delegated'); var class_deletaged_list = GetElementsWithClassName('td','delegated');
for(var i=0; i<class_deletaged_list.length; i++) { for(var i=0; i<class_deletaged_list.length; i++) {
element = class_deletaged_list[i].childNodes[1]; var disable_children = class_deletaged_list[i].childNodes;
for (var j=0; j<disable_children.length; j++) {
var element = disable_children[j];
if (element.type == 'hidden'){ if (element.type == 'hidden'){
element = element.nextSibling; continue;
} }
element.readOnly = true; element.readOnly = true;
if (element.type == 'checkbox'){ if (element.type == 'checkbox'){
element.onclick = ignoreEvent; element.onclick = ignoreEvent;
} }
}
} }
function toggleFieldState(evt) { function toggleFieldState(evt) {
...@@ -177,9 +180,11 @@ function toggleFieldState(evt) { ...@@ -177,9 +180,11 @@ function toggleFieldState(evt) {
allElements = tr_parent.childNodes; allElements = tr_parent.childNodes;
for (i=0; i<allElements.length; i++) { for (i=0; i<allElements.length; i++) {
if (isClass(allElements[i], 'to_disable')) { if (isClass(allElements[i], 'to_disable')) {
field = allElements[i].childNodes[1]; var disable_children = allElements[i].childNodes;
for (var j=0; j<disable_children.length; j++) {
var field = disable_children[j];
if (field.type == 'hidden'){ if (field.type == 'hidden'){
field = field.nextSibling; continue;
} }
if (field.readOnly){ if (field.readOnly){
field.readOnly = false; field.readOnly = false;
...@@ -195,6 +200,7 @@ function toggleFieldState(evt) { ...@@ -195,6 +200,7 @@ function toggleFieldState(evt) {
} }
} }
} }
}
} }
</script> </script>
<dtml-var manage_page_footer> <dtml-var manage_page_footer>
......
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