I put this code in view as custom of a fields (controls) 'nimporto' and 'nimpgef':
$value=$data["esito"];
if ($value == 'POSITIVO') {
$color="green";
} else {
$color="red";
}
$value="<span style='background-color: " . $color . ";'>$value</span>";
it works fine only in list page, the background-color change in according of the value of the "esito" field (control) but in edit page the background-color remain white
-----
in javascript on load event of edit page i put this code:
//versione phprunner 5.3
try{
var ctrlTipo = Runner.getControl(pageid, 'esito');
var ctrlnimporto = Runner.getControl(pageid, 'nimporto');
var ctrlnimpgef = Runner.getControl(pageid, 'nimpgef');
ctrlTipo.on('change', function(e){
//
if (this.getValue() == 'POSITIVO'){
ctrlnimporto.show();
ctrlnimpgef.show();
ctrlTipo.addStyle('background-color : green ;');
ctrlnimporto.addStyle('background-color : green ;');
ctrlnimpgef.addStyle('background-color : green ;');
}
else{
ctrlTipo.addStyle('background-color : red ;');
ctrlnimporto.addStyle('background-color : red;');
ctrlnimpgef.addStyle('background-color : red ;');
}
});
}
catch(exception){}
when in edit page i change the value of control 'esito' it works fine and the background-color is set in according of the value of 'esito' control, but the second time i enter in edit page the background-color of controls remain white.
may help me ?
Thanks