New: add possibility to disable or show/hide another elements
This commit is contained in:
parent
72304505cb
commit
303521d14c
@ -221,7 +221,7 @@ function ajax_combobox($htmlname)
|
|||||||
* @param string $code Name of constant
|
* @param string $code Name of constant
|
||||||
* @param array $input Input element
|
* @param array $input Input element
|
||||||
* @param int $entity Entity to set
|
* @param int $entity Entity to set
|
||||||
* TODO add different method for other input (show/hide, disable, ..)
|
* @return void
|
||||||
*/
|
*/
|
||||||
function ajax_constantonoff($code,$input=array(),$entity=false)
|
function ajax_constantonoff($code,$input=array(),$entity=false)
|
||||||
{
|
{
|
||||||
@ -243,15 +243,20 @@ function ajax_constantonoff($code,$input=array(),$entity=false)
|
|||||||
function() {
|
function() {
|
||||||
$("#set_'.$code.'").hide();
|
$("#set_'.$code.'").hide();
|
||||||
$("#del_'.$code.'").show();
|
$("#del_'.$code.'").show();
|
||||||
// Enable another object
|
// Enable another element
|
||||||
if (input.length > 0) {
|
if (input.disabled && input.disabled.length > 0) {
|
||||||
$.each(input, function(key,value) {
|
$.each(input.disabled, function(key,value) {
|
||||||
$("#" + value).removeAttr("disabled");
|
$("#" + value).removeAttr("disabled");
|
||||||
if ($("#" + value).hasClass("butActionRefused") == true) {
|
if ($("#" + value).hasClass("butActionRefused") == true) {
|
||||||
$("#" + value).removeClass("butActionRefused");
|
$("#" + value).removeClass("butActionRefused");
|
||||||
$("#" + value).addClass("butAction");
|
$("#" + value).addClass("butAction");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
// Show another element
|
||||||
|
} else if (input.showhide && input.showhide.length > 0) {
|
||||||
|
$.each(input.showhide, function(key,value) {
|
||||||
|
$("#" + value).show();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -266,15 +271,20 @@ function ajax_constantonoff($code,$input=array(),$entity=false)
|
|||||||
function() {
|
function() {
|
||||||
$("#del_'.$code.'").hide();
|
$("#del_'.$code.'").hide();
|
||||||
$("#set_'.$code.'").show();
|
$("#set_'.$code.'").show();
|
||||||
// Disable another object
|
// Disable another element
|
||||||
if (input.length > 0) {
|
if (input.disabled && input.disabled.length > 0) {
|
||||||
$.each(input, function(key,value) {
|
$.each(input.disabled, function(key,value) {
|
||||||
$("#" + value).attr("disabled", true);
|
$("#" + value).attr("disabled", true);
|
||||||
if ($("#" + value).hasClass("butAction") == true) {
|
if ($("#" + value).hasClass("butAction") == true) {
|
||||||
$("#" + value).removeClass("butAction");
|
$("#" + value).removeClass("butAction");
|
||||||
$("#" + value).addClass("butActionRefused");
|
$("#" + value).addClass("butActionRefused");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
// Hide another element
|
||||||
|
} else if (input.showhide && input.showhide.length > 0) {
|
||||||
|
$.each(input.showhide, function(key,value) {
|
||||||
|
$("#" + value).hide();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user