I have two tables:
- contacts
- phonetypes
In my add action, i populate a dropdown box from the phonetypes table (which has only 1 column, namely phone_type).
My contacts table has the fields: l_name, f_name, phone_type and number.
I have the dropdown's displayField as phone_type. Based on the selection in the dropdown I try to insert the phone_types field in the contacts table, but it inserts the id from the phonetypes table. But I want to insert the values and not the id...
Any help is appreciated.
My view code:
echo $this->Form->create('Contact');
echo $this->Form->input('last_name', array('type'=>'text', 'size'=>10));
echo $this->Form->input('first_name');
echo $this->Form->select('phonetypes.phone_type',array('phone_type'=>'phone_type','options'=>$phone_type,'default'=>'phone_type'));
echo $this->Form->input('phone_number');
echo $this->Form->end('Save Entry');