diff --git a/lib/formslib.php b/lib/formslib.php
index 3fddeca2ad0..8ce6952aa61 100644
--- a/lib/formslib.php
+++ b/lib/formslib.php
@@ -1170,34 +1170,39 @@ function validate_' . $this->_formName . '(frm) {
}
function getLockOptionEndScript(){
+
+ $iname = $this->getAttribute('id').'items';
$js = ''."\n";
return $js;
}
- function _getElNamesRecursive(&$element, $group=null){
+ function _getElNamesRecursive($element, $group=null){
if ($group==null){
$el = $this->getElement($element);
} else {
@@ -1237,16 +1242,27 @@ function validate_' . $this->_formName . '(frm) {
* @param string $condition the condition to check
* @param mixed $value used in conjunction with condition.
*/
- function disabledIf($elementName, $dependentOn, $condition = 'notchecked', $value=null){
- $this->_dependencies[$dependentOn][] = array('dependent'=>$elementName,
- 'condition'=>$condition, 'value'=>$value);
+ function disabledIf($elementName, $dependentOn, $condition = 'notchecked', $value='1'){
+ if (!array_key_exists($dependentOn, $this->_dependencies)) {
+ $this->_dependencies[$dependentOn] = array();
+ }
+ if (!array_key_exists($condition, $this->_dependencies[$dependentOn])) {
+ $this->_dependencies[$dependentOn][$condition] = array();
+ }
+ if (!array_key_exists($value, $this->_dependencies[$dependentOn][$condition])) {
+ $this->_dependencies[$dependentOn][$condition][$value] = array();
+ }
+ $this->_dependencies[$dependentOn][$condition][$value][] = $elementName;
}
+
function registerNoSubmitButton($buttonname){
$this->_noSubmitButtons[]=$buttonname;
}
+
function isNoSubmitButton($buttonname){
return (array_search($buttonname, $this->_noSubmitButtons)!==FALSE);
}
+
function _registerCancelButton($addfieldsname){
$this->_cancelButtons[]=$addfieldsname;
}
diff --git a/lib/javascript-static.js b/lib/javascript-static.js
index 9af0df8a255..60a0713c03d 100644
--- a/lib/javascript-static.js
+++ b/lib/javascript-static.js
@@ -81,65 +81,56 @@ function unlockoption(form,item) {
eval("form.h"+item+".value=0");
}
}
+
+
function lockoptionsall(formid) {
- var lock = new Object();
- var items = eval(formid+'items');
- var form = document.forms[formid];
- for (var master in items){
- var subitems=items[master].dependents;
- var thislock;
- if (items[master].condition=='notchecked'){
- thislock=!form.elements[master].checked;
- } else if (items[master].condition=='checked'){
- thislock=form.elements[master].checked;
- } else if (items[master].condition=='noitemselected'){
- thislock=(form.elements[master].selectedIndex==-1);
- } else if (items[master].condition=='eq'){
- thislock=(form.elements[master].value==items[master].value);
- } else {
- thislock=(form.elements[master].value!=items[master].value);
-
- }
-
- for (var i=0; i