How to combine two fields into one select box, when on the edit form

How to combine two fields into one select box, when on the edit form

huba_sbfhuba_sbf Posts: 16Questions: 6Answers: 1

Hey guys,
I've been reading the forum to find a solution for this, but couldn't find anything helpful, sorry if this has been answered already. I am actually quite sure it has been done.

Here is my problem:
1. I have a db table containing people, pilots actually (First name, Last name etc.)
2. I have another table which will contain the track times for the pilots.
When adding the track times, I will need a combo to select the pilot, but having only the "first" or "last name" in it creates confusion.
Is there a way to combine both fields in the combo and have a list with both these fields?

Sample code from the server script:
Field::inst( 'times.id_pilot' )
->options( 'pilots', 'id', 'fname' )
->validator( 'Validate::dbValues' ),
Field::inst( 'pilots.lname as pilot' ),
Field::inst( 'pilots.fname as fname' ),
Field::inst( 'pilots.lname as lname' ),

Sample code from the HTML
fields: [
{
label: "Pilot:",
name: "times.id_pilot",
type: "select",
placeholder: "Select a pilot"
}
...

Thank you very much.

This question has an accepted answers - jump to answer

Answers

This discussion has been closed.