I'm migrating to CakePHP 2.0, and run into this problem with the
FormHelper. I have a Book model and a related Author model:

var $uses = array('Book', 'Author');

I'm creating an autocomplete field for Author in the Book edit form,
which will look for existing author names. In the beforeSave()
function, I'm mapping these names to author IDs. So I want to have
author name fields which the user can type the name into. When
generating the form, I create the fields for existing authors inside a
foreach loop:

$i = 0;
foreach($this->data['Author'] as $author){
    echo $this->Form->input('Author.' . $i . '.name', array('value' =>
$author['name']));
    $i++;
}

In Cake 1.3, it would generate fields like this:

<input name="data[Author][0][name]" type="text" value="John Steinbeck"
id="Author0Name">

But in Cake 2.0, I'm getting:

<input name="data[Author][Author]" type="text" value="John Steinbeck"
id="AuthorAuthor">

Which doesn't handle multiple fields properly. Anyone know what might
be going on here?

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
[email protected] For more options, visit this group at 
http://groups.google.com/group/cake-php

Reply via email to