Hi people =)
I'm using "set_relation()" to successfully relate one table to another, no problem there.
My question is, when I'm creating a new entry, the Add form brings me the "set_relation()" field but it only contais values that ARE related between the two tables. Since I am adding a new entry, I needed that the "set_relation()" to bring me all the values of that related table.
Example:
I want to list Persons and show the correct City name
CREATE TABLE Persons ( PersonID int, LastName varchar(255), FirstName varchar(255), CityID varchar(255) ); CREATE TABLE Cities ( CityID int, CityName varchar(255), CityCode varchar(255) );
$crud->set_relation('CityID','Cities','CityName');
The problem is when I try to add a new Person, the City field shows me only "Quahog" and "New York"!
Since no Persons entry has a CityID "1", the "Sidney" option does not show up!
I am inserting a new entry on Persons table, I need to choose any Cities value, not only between the ones that already have a relation between the two tables.
erm ... got it? =)
Thanks!