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) {
}
return elemColl;
}
function normalEvent() { return true; }
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 = class_deletaged_list[i].childNodes[2];
element = element.nextSibling;
}
element.readOnly = true;
if (element.type == 'checkbox'){
element.onclick = ignoreEvent;
}
}
function toggleFieldState(evt) {
......@@ -173,13 +179,19 @@ function toggleFieldState(evt) {
if (isClass(allElements[i], 'to_disable')) {
field = allElements[i].childNodes[1];
if (field.type == 'hidden'){
field = allElements[i].childNodes[2];
field = field.nextSibling;
}
if (field.readOnly){
field.readOnly = false;
if (field.type == 'checkbox'){
field.onclick = normalEvent;
}
}
else{
field.readOnly = true;
if (field.type == 'checkbox'){
field.onclick = ignoreEvent;
}
}
}
}
......
......@@ -155,13 +155,19 @@ function GetElementsWithClassName(elementName,className) {
}
return elemColl;
}
function normalEvent() { return true; }
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 = class_deletaged_list[i].childNodes[2];
element = element.nextSibling;
}
element.readOnly = true;
if (element.type == 'checkbox'){
element.onclick = ignoreEvent;
}
}
function toggleFieldState(evt) {
......@@ -173,13 +179,19 @@ function toggleFieldState(evt) {
if (isClass(allElements[i], 'to_disable')) {
field = allElements[i].childNodes[1];
if (field.type == 'hidden'){
field = allElements[i].childNodes[2];
field = field.nextSibling;
}
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