Hide / Not hide a Html field on a form (master/detail) checking the value of a field

Dear all,
I got a form (master/detail) about sales orders and I have to show to the user if that Order has been done via WEB or not.
I added to the end of master form a new HTML field like a Yellow Dot and I want to show it only when the TipoOrd == “C9” (means done by web)

I’ve tried to put the following code under
OnLoad
OnApplicationInit
OnScriptInit

without success. The dot is visible but it’s not connected to testing routing (a…mess)

//Display B2B yellow dot
sc_reset_apl_conf(“form_orders”);

$sql_ceck_order_type=“SELECT Tipo_Ord FROM orders WHERE OrderID = {OrderID}”;
sc_lookup(ds_order_type, $sql_ceck_order_type);

if(isset({ds_order_type[0][0]}))
{
[ds_order_type]={ds_order_type[0][0]};
echo "<BR>TIPO ORD " .[ds_order_type];
if([ds_order_type]==“C9”)
{sc_apl_conf(“form_orders”, “field_display_on”, “TipoOrd”);}
else {sc_apl_conf(“form_orders”, “field_display_off”, “TipoOrd”);}

}

I changed the sc_macro function and now it works like a charm !!! Yeahhhhhhhh

//Display B2B yellow dot

$sql_ceck_order_type=“SELECT Tipo_Ord FROM orders WHERE OrderID = {OrderID}”;
sc_lookup(ds_order_type, $sql_ceck_order_type);

if(isset({ds_order_type[0][0]}))
{
[ds_order_type]={ds_order_type[0][0]};
if([ds_order_type]==“C9”)
//{sc_apl_conf(“form_orders”, “on”, “TipoOrd”);}
{sc_field_display({TipoOrd},“on”)}
else
// {sc_apl_conf(“form_orders”, “off”, “TipoOrd”);}
{sc_field_display({TipoOrd},“off”)}
}