0
我有兩個表的數據庫存儲下拉值:使用CakePHP
- 接觸
- phonetypes
在我的附加動作,我填充從phonetypes
表下拉框(其中有隻1列,即phone_type
)。
我的contacts
表中的字段包括:l_name
,f_name
,phone_type
和number
。
我有下拉的displayField爲phone_type
。根據下拉列表中的選擇,我嘗試在contacts
表中插入phone_types
字段,但它會插入phonetypes
表中的ID。但我想插入的值,而不是編號...
任何幫助表示讚賞。
我的視圖代碼:
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');
這將有助於查看您正在使用的一些代碼。嘗試發佈你的模型和你所指的添加動作。 – Oldskool 2012-02-14 22:00:39
請在您的視圖中添加代碼,其中是phonetype列表,問題可能在那裏。 – 2012-02-14 22:14:10
我已經包含了我的視圖代碼。希望這有助於解決我的簡單問題 – Pradeep 2012-02-15 01:33:12