views:

13

answers:

1

This is causing me a bit of frustration this morning/late last night, and I'm sure I must be missing something painfully simple here....

In my view I have:

echo $this->Form->input('form_generator_field_type_id');

and in my controller I have:

$form_generator_field_types=$this->FormField->FormFieldType->find('list');
$this->set('form_generator_field_types',$form_generator_field_types);

Which results in setting $form_generator_field_types in my view to be:

Array(
[1] => text
[2] => checkbox
[3] => textarea)

Doesn't the form helper simply fill in the field with an array of values from a pluralized version of the field name? (ie: page_id would get filled with $pages)?

Just for reference (not sure if it could be the cause of the issue, my belongsTo relationship that is defined in FormField is:

var $belongsTo = array(
            'FormFieldType' => array(
                    'className' => 'form_generator.FormFieldType',
                    'foreignKey' => 'form_generator_field_type_id'                
            )
    );

Any direction/suggestions would be greatly appreciated!

Thanks

A: 

Figured out my problem. The helper does look for a pluralized variable. However, what I failed to notice in the documentation is that it is looking for a camelCased version... so in my example..

$this->set('form_generator_field_types',$form_generator_field_types);

should have been

$this->set('formGeneratorFieldTypes',$form_generator_field_types);
Ryan
+1 for following up with the answer.
Rob Wilkerson
the camel case has nothing to do with it, its about the relations. i think what you are looking for is form_field_type_id
dogmatic69