Hello, I am developing a web page that allows users to create a report from a web form. Currently, I've created a client table called "People" and a report table called "Inspections" (see the SQL and associated scaffolded views).
*CLIENT TABLE* * * CREATE TABLE HostMyInspectionDB.people ( id int(11) unsigned NOT NULL auto_increment, email varchar(150) default NULL, first_name varchar(60) NOT NULL, last_name varchar(60) NOT NULL, phone_number int(12) NOT NULL, PRIMARY KEY (id) ); <https://lh6.googleusercontent.com/-VI6pOzaFeB0/UKB1nIq52sI/AAAAAAAAAgE/qCE0M0YcdbE/s1600/People+Table.jpg> *REPORT TABLE* CREATE TABLE HostMyInspectionDB.inspections ( id int(11) unsigned NOT NULL auto_increment, address_line varchar(100) NOT NULL, city varchar(60) NOT NULL, state_province_region varchar(60) NOT NULL, zip int(10) NOT NULL, country varchar(60) NOT NULL, person_id int(11) NOT NULL, PRIMARY KEY (id) ); <https://lh6.googleusercontent.com/-gt1PJlxFhyE/UKB2L7kypOI/AAAAAAAAAgM/WtIyichSASg/s1600/Inspection+Table.jpg> Notice the "Person" drop-down field in the second screenshot just above. This drop-down is referring to the people.id column, acting as a foreign key for the inspection table. *How do I change the drop-down to refer to the people.email column instead?* My model and controller code is pasted below: <?php > class Person extends AppModel > { > var $name = 'Person'; > var $hasMany = array('Inspection'); > } > ?> class Inspection extends AppModel { var $name = 'Inspection'; var $belongsTo = array('Person'); } ?> <?php class PeopleController extends AppController { var $name = 'People'; var $scaffold; } ?> <?php class InspectionsController extends AppController { var $name = 'Inspections'; var $scaffold; } ?> -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. Visit this group at http://groups.google.com/group/cake-php?hl=en.
