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,13 +160,16 @@ function ignoreEvent() { return false; } ...@@ -160,13 +160,16 @@ 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;
if (element.type == 'hidden'){ for (var j=0; j<disable_children.length; j++) {
element = element.nextSibling; var element = disable_children[j];
} if (element.type == 'hidden'){
element.readOnly = true; continue;
if (element.type == 'checkbox'){ }
element.onclick = ignoreEvent; element.readOnly = true;
if (element.type == 'checkbox'){
element.onclick = ignoreEvent;
}
} }
} }
...@@ -177,20 +180,23 @@ function toggleFieldState(evt) { ...@@ -177,20 +180,23 @@ 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;
if (field.type == 'hidden'){ for (var j=0; j<disable_children.length; j++) {
field = field.nextSibling; var field = disable_children[j];
} if (field.type == 'hidden'){
if (field.readOnly){ continue;
field.readOnly = false;
if (field.type == 'checkbox'){
field.onclick = normalEvent;
} }
} if (field.readOnly){
else{ field.readOnly = false;
field.readOnly = true; if (field.type == 'checkbox'){
if (field.type == 'checkbox'){ field.onclick = normalEvent;
field.onclick = ignoreEvent; }
}
else{
field.readOnly = true;
if (field.type == 'checkbox'){
field.onclick = ignoreEvent;
}
} }
} }
} }
......
...@@ -160,13 +160,16 @@ function ignoreEvent() { return false; } ...@@ -160,13 +160,16 @@ 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;
if (element.type == 'hidden'){ for (var j=0; j<disable_children.length; j++) {
element = element.nextSibling; var element = disable_children[j];
} if (element.type == 'hidden'){
element.readOnly = true; continue;
if (element.type == 'checkbox'){ }
element.onclick = ignoreEvent; element.readOnly = true;
if (element.type == 'checkbox'){
element.onclick = ignoreEvent;
}
} }
} }
...@@ -177,20 +180,23 @@ function toggleFieldState(evt) { ...@@ -177,20 +180,23 @@ 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;
if (field.type == 'hidden'){ for (var j=0; j<disable_children.length; j++) {
field = field.nextSibling; var field = disable_children[j];
} if (field.type == 'hidden'){
if (field.readOnly){ continue;
field.readOnly = false;
if (field.type == 'checkbox'){
field.onclick = normalEvent;
} }
} if (field.readOnly){
else{ field.readOnly = false;
field.readOnly = true; if (field.type == 'checkbox'){
if (field.type == 'checkbox'){ field.onclick = normalEvent;
field.onclick = ignoreEvent; }
}
else{
field.readOnly = true;
if (field.type == 'checkbox'){
field.onclick = ignoreEvent;
}
} }
} }
} }
......
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