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

Popular posts from this blog

javascript - gulp-nodemon - nodejs restart after file change - Error: listen EADDRINUSE events.js:85 -

Fatal Python error: Py_Initialize: unable to load the file system codec. ImportError: No module named 'encodings' -

javascript - oscilloscope of speaker input stops rendering after a few seconds -