Fill choice field of module with data from HubDB table
SOLVE
Hi,
I am creating a custom module that consists of the following fields: intro text, form and a contact person. I can add the intro text and form via a rich text and form field.
I also have a HubDB table called 'persons'. For the field of contact person I would like a choice field in which the names come from this table.
I solved it for now by creating an extra HubDB table with 2 columns (page name and contact person, which is a foreign key to the person table). On the template itself I will then filter the table based on the current page name so I get the corresponding row with the corresponding contactperson.
The only problem that can occur is when changing the page name, no more results will be found because the page name in the table does not match anymore.