Resolved.
To explain better, I’ll give you a practical example.
I have a field in the form called “height”.
I want the background of the field depending on the values to take on a color.
Let’s simplify as much as possible:
50 yellow
< 50 green
-
I go to Programming – Javascript Methods.
I create a new method that I call “color_background”
Before writing the instructions, I click on the F(x) icon on the editor toolbar, to set the number of parameters. In my case 1 , I call height.
At this point I write the instructions:
if (height > 50 )
{
document.F1.height.style.color = ‘black’;
document.F1.height.style.backgroundColor = ‘#FFCC33’;
}
if (height < 50 )
{
document.F1.height.style.color = ‘black’;
document.F1.height.style.backgroundColor = ‘#66CC33’;
}
I save the script.
-
I go to Events and choose OnLoad
sc_ajax_javascript (‘background_color’,array({height}));
The first argument refers to the javascript script name and the second is the return parameter.
I save and run.
Surely it can be improved, but for the moment I’m happy with it.
I hope it can be useful.
Massimo