I'm trying to come up with a standard way to create multiple forms for the same model on an index page. Here's a little more detail.
I have a list of binders, each with a memo being displayed. I would like the memo fields to be editable from the index page. Obviously it doesn't work to just copy and paste the view for the edit_memo action, like so:
<?php echo $this->Form->create('Binder');?>
<fieldset>
<legend><?php __('Edit Memo'); ?></legend>
<?php
echo $this->Form->input('id');
echo $this->Form->input('memo');
?>
</fieldset>
<?php echo $this->Form->end(__('Submit', true));?>
But that's essentially what I'm looking to do. In context, I'm just looping through the binders in the index action and the memos are part of the model.
I've tried changing $this->Form->create('Binder')
to the following:
$this->Form->create(null,array(
'id'=>"BinderEditMemo.$i",
'controller' => 'binders',
'action' => 'edit_memo',
'id' => $binder['Binder']['id']
));
But no luck. The memo field still gets the regular id, so I think I might need to change that as well. When I submit the form it does perform the action, however it does not save. FYI, I have routed the id parameter to the action in my routes.
I'm sure there has to be a standard way to render multiple forms in the index loop. Any thoughts?