Where put code to fill SelectOptions for custom field
Brought to you by:
jberanek
Hi, I want to run these code in order to fill the options por custom field...
~~~~php
$Sql="Select fiscalid, nombre from mrbsfiscal where activo = 1 order by nombre asc ";
$fiscales = array();
$res = db()->query($sql);
for ($i = 0; ($row = $res->rowkeyed($i)); $i++)
{
$fiscales[$row['fiscalid']]=$row['nombre'];
}
$selectoptions['entry.fiscalid'] = $fiscales;*
~~~~
where should I put this?, If a put it in config.sys.inc I get the error:
Thanks. !
Can you explain more about what you are trying to do?
I have a custom field 'fiscalid'.
I want to set the $Select_Options array with values from a table in the DataBase.
I have found in another topic that it could be done in the 'create_field_entry_custom_field' function.
I've tried with the code I put before, but I can't get it working.
Solved!
Did a new method for the class BD:
And then call it in the start of the edit_entry.php
Thanks.
Last edit: Campbell Morrison 2019-10-04