php - CakePHP HABTM Select box in edit mode not populating -
i feel i'm going insane. can figure these things out 1 has stuck. i'm using cake 2.3.7. noticed there bug in earlier versions of cakephp.
hope can point out i'm going wrong. on site have articles have 3 habtm associations > flies, rivers , lakes. so:
article - habtm - fly article - habtm - river article - habtm - lake
controller:
... $flies = $this->article->fly->find('list'); $lakes = $this->article->lake->find('list'); $rivers = $this->article->river->find('list'); $this->set(compact('flies', 'lakes', 'rivers'));
view:
echo $this->form->input('fly'); echo $this->form->input('lake'); echo $this->form->input('river');
this syntax seems described in manuals cakephp 2.x, , works on local test system, upload server, fails.
any appreciated, , let me know if more information needed.
for habtm associations form fields should be:-
echo $this->form->input('fly.fly'); echo $this->form->input('lake.lake'); echo $this->form->input('river.river');
otherwise you're doing in controller looks correct.
Comments
Post a Comment