How can I create multiple forms on a single page in CakePHP? -


I am trying to come up in a standard way to create several variations of the same model on an index page. Here's a little more detail.

I have a list of binary, each is being displayed with a memo. I need to be editable from memo fields index page. Obviously this does not work to copy and paste the view for editing_metro action, such as:

    

But this is essentially what I am doing. In context, I'm just looping through a bond in the induction action and being part of the memo model.

I have tried to change the form of 'code-> $-> form-> change (' binder ') to do the following:

  $ this-> Form- & gt; Create (empty, array ('id' = & gt; "binding edit memo. $ I", 'controller' = & gt; 'binders', 'action' => edit_memo, 'id' = & Gt; $ binders ['binders'] ['id']));   

But no luck memo field still receives regular IDs, so I think I may need to make changes in that form too. When I submit the form it does the action, though it does not save. FYI, I have rooted the ID parameter to act in my own way.

I am sure the index should be a standard way of presenting multiple forms in the loop. Any ideas?

This is not very difficult, but you have to rely on cake form helper magic to a lesser degree . The following has worked for me (or at least for many occasions):

   Form- & gt; Create ('typing', array ('url' = & gt; $ url)); Now $ $-> Form- & gt; Input ('binder.id', array ('type' = & gt; 'hidden', 'value' = & gt; $ _ binder ['id'])); Echo $ this - & gt; Form- & gt; Input ('binder' memo ', array (' value '=> gt; $ _ binders [' memo '])); Echo $ the-> Form- & gt; End (__ ('submit', true)); }? & Gt;   

I'm not sure about the structure of your data, so the latter will need some tweaking, but you should get this idea. I have no idea what is done by making false models and etc.

Comments