AutoMagic select box not populating in CakePHP -


i've got following relationship set-up between 2 models

  • story belongsto storytype
  • storytype hasmany story

i've set-up form select storytype each story using following code:

echo $this->form->input('story.story_type_id', array('tabindex' => 2)); 

with code in controller populate list

$this->set('story_types', $this->story->storytype->find('list', array ('order' => 'title'))); 

but it's not populating select box anything. know find() option working because doing debug within controller produces this:

array (     [1] => first person     [3] => third person ) 

the weird thing it's same code, querying other models, populate select lists things users , genres, it's story types isn't working.

any ideas? cheers.

you don't mention version of cakephp you're using, try setting storytypes rather story_types:

$this->set( 'storytypes', $this->story->storytype->find( 'list', array( 'order' => 'title' ) ) ); 

older versions of cakephp (pre-1.3) modified set variable names headlesscamelcase and, if you're using 1.3.x, there may little bit of infrastructure lingering. it's bit of reach, it's easy enough test , seems plausible root of problem.

i'll curious see find out.


Comments

Popular posts from this blog

android - Spacing between the stars of a rating bar? -

html - Instapaper-like algorithm -

c# - How to execute a particular part of code asynchronously in a class -