Select field showing more than one column from another table
Select field showing more than one column from another table

Hello All,
I want to know if it's possible to show more than on column from another table inside a dropdown select list.
For example, I have the table Customer, with first and last name separated, then I have the sales table, that I can select in a dropdown list the customer, but I need to see on this dropdown list both names. How can I do that?
Thanks in advance!
BR,
Danilo
Answers
Hi Danilo,
Can you provide a little more information please? For example is this using an Editor form? Can you post a screenshot of what you currently have? I'm not quite managing to picture it at the moment I'm afraid.
Allan
Actually, yes, I am using the editor.
I don't have anything ready yet or I'm trying to do it, but let's suppose I have:
Table: Customer
Field: Customer ID
Field: First Name
Field: Last Name
Table: Sales
Field: Sales ID
Field: Customer ID
In the form where I have to register a sale, using the Sales table, I would like the dropdown field (select type field) that has the Customer ID to show a combination of the First and Last Name fields
Have I made myself clearer now?
Thank you very much in advance...
Yes! Many thanks for the clarification.
You just need to specify the
->label()
method for theOptions
instance for that field with the two columns you want (assuming you are using the provided PHP, .NET or Node.js libraries?).There is an example of this here - specifically in the PHP:
See the
Options->label()
documentation for more details.Allan