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