0
votes

I am trying to categorise checkboxes with category|productname values. I need to use the cakephp form helper so I am somewhat clueless as to how to do that. I tried to use an array as the input name, but I am getting a lot of errors:

 // Current code:
 $this->Form->input(array("catname","prodname"),array(....)

 // Expected for html:
 <input name="data[formname][catname][prodname]" ... ">

Any ideas on how to do this?

2

2 Answers

4
votes

You can use:

$this->Form->input('formname.catname.prodname', ...);
0
votes

I am trying the same, I just figured out that you can print arrays with helpers this way

// Current code:
 $this->Form->input('Model.0.object');

For example, if you have 10 objects related to this model, that will print the first one, same for 1, 2 etc.