Hi Guys,
I am trying to conditionally change the font colour on a control on a add/edit page.
The conditional part of my code works great but I can't seem to get the font to change colour based on the condition.
I was hoping to use the Javascript API to achieve this as described here https://xlinesoft.com/phprunner/docs/how_to_change_font_in_edit_con.htm
var ctrl = Runner.getControl(pageid, 'Make');
ctrl.addStyle('font-size: 12px; color: red;');
However nothing I try seem to works with changing the font colour on the fly.
I can change the text colour on the list page "view as custom", but I need to do it on add/edit page
Can I use .addStyle Javascript for this purpose? If not any ideas/suggestions would be very much appreciated.
var ctrlAge1 = Runner.getControl(pageid, 'rag_One_Days');
var ctrlRag1 = Runner.getControl(pageid, 'rag_One_Complex_Home_Package_Needed');
var ctrlRag11 = Runner.getControl(pageid, 'rag_One_Referral_To_Community');
var ctrlRag1warn = Runner.getControl(pageid, 'rag_One_Warning');
ctrlAge1.on('change', function(e) {
if (ctrlAge1.getValue() <8 && ctrlAge1.getValue() >0){
ctrlRag1warn.setValue("Green <8");
ctrlRag1warn.addStyle('font-size: 16px; color: red;');
}
else if (ctrlAge1.getValue() >=8 && ctrlAge1.getValue() <=14){
ctrlRag1warn.setValue("Amber 8 to 14");
}
else if (ctrlAge1.getValue() >14){
ctrlRag1warn.setValue("Red >14");
}
else {
ctrlRag1warn.setValue("None");
}
}
)
Best wishes
James