Commit dd0bce2b authored by Nicolas Dumazet's avatar Nicolas Dumazet

if field is a checkbox, do not allow click on it while its readonly


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@36120 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 0a59322b
...@@ -155,13 +155,19 @@ function GetElementsWithClassName(elementName,className) { ...@@ -155,13 +155,19 @@ function GetElementsWithClassName(elementName,className) {
} }
return elemColl; return elemColl;
} }
function normalEvent() { return true; }
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]; element = class_deletaged_list[i].childNodes[1];
if (element.type == 'hidden'){ if (element.type == 'hidden'){
element = class_deletaged_list[i].childNodes[2]; element = element.nextSibling;
} }
element.readOnly = true; element.readOnly = true;
if (element.type == 'checkbox'){
element.onclick = ignoreEvent;
}
} }
function toggleFieldState(evt) { function toggleFieldState(evt) {
...@@ -173,13 +179,19 @@ function toggleFieldState(evt) { ...@@ -173,13 +179,19 @@ function toggleFieldState(evt) {
if (isClass(allElements[i], 'to_disable')) { if (isClass(allElements[i], 'to_disable')) {
field = allElements[i].childNodes[1]; field = allElements[i].childNodes[1];
if (field.type == 'hidden'){ if (field.type == 'hidden'){
field = allElements[i].childNodes[2]; field = field.nextSibling;
} }
if (field.readOnly){ if (field.readOnly){
field.readOnly = false; field.readOnly = false;
if (field.type == 'checkbox'){
field.onclick = normalEvent;
}
} }
else{ else{
field.readOnly = true; field.readOnly = true;
if (field.type == 'checkbox'){
field.onclick = ignoreEvent;
}
} }
} }
} }
......
...@@ -155,13 +155,19 @@ function GetElementsWithClassName(elementName,className) { ...@@ -155,13 +155,19 @@ function GetElementsWithClassName(elementName,className) {
} }
return elemColl; return elemColl;
} }
function normalEvent() { return true; }
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]; element = class_deletaged_list[i].childNodes[1];
if (element.type == 'hidden'){ if (element.type == 'hidden'){
element = class_deletaged_list[i].childNodes[2]; element = element.nextSibling;
} }
element.readOnly = true; element.readOnly = true;
if (element.type == 'checkbox'){
element.onclick = ignoreEvent;
}
} }
function toggleFieldState(evt) { function toggleFieldState(evt) {
...@@ -173,13 +179,19 @@ function toggleFieldState(evt) { ...@@ -173,13 +179,19 @@ function toggleFieldState(evt) {
if (isClass(allElements[i], 'to_disable')) { if (isClass(allElements[i], 'to_disable')) {
field = allElements[i].childNodes[1]; field = allElements[i].childNodes[1];
if (field.type == 'hidden'){ if (field.type == 'hidden'){
field = allElements[i].childNodes[2]; field = field.nextSibling;
} }
if (field.readOnly){ if (field.readOnly){
field.readOnly = false; field.readOnly = false;
if (field.type == 'checkbox'){
field.onclick = normalEvent;
}
} }
else{ else{
field.readOnly = true; 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