[EXTENSION] multimodelform/jqrelcopy

very awesome extension, worked really well after reading the forum posts, keep posting guys very helpful, and to the author of the extension a very big thanks :D . Quick question, How can one access the IDs for the cloned form elements?


i need dropdownlist for a boolean field (as checkbox doesn’t work) in multimodelform, the field is correctly saved but when i open my form it always show the first value even if it’s the second in database.

      $relStudentSemesterFormConfig = array(





			'items'=>array( 1 => 'Oui', 0 => 'Non'),






				'success' => 'function(data) 






Have you got an idea?


A short adhoc answer:

A single checkbox doesn’t work, but you can use a Checkboxlist with one item instead.

See Howto checkboxes

Thanks Joblo,

i tried checkboxlist but i have also problems with it, the choice is never selected for instance.

Hi Joblo (and all),

yep, thanks, great extension.

I’ve been using it and it surely does the job. But in my new app, I have a related model with a composite Primary Key. Current MMF version wasn’t working for me, so I’ve downloaded and tried the “Elix patch”, that uses an older version of jquery-relcopy though (3.3 vs. 4.0).

With the patch, my compositePK-model is shown but: adding a new clone doesn’t work, remove does but the element you just removed gets added again if you then add, if you save after removing an element CDbCommandBuilder raises an Exception for an undefined offset while checking columns’ raw names.

So, my questions are:

  • do you have an alternative/better solution for composite PK models, apart from redesigning tables to use a simple PK?

  • (hopeless) do you have any experience with the above patch? Elix, are you reading this? Could you provide any additional experience regarding your patch?



got the same problem for the composite primary key.

how can i manage it?


First of all, thanks for this great extension.

There is a way to make an nested MultimodelForm?

Very nice extension.

Could you add support for Foundation 3 styles (like you did for Bootstrap)?

Could you also add option for change rendering class (default is MultiModelRenderForm) to configuration file? Now if i want to extend it i need to extend also MultiModelForm class and override some methods like renderTableBegin (or change extension code - bad idea…).

Released v.4.5

  • added support for composite pk -> rashmani, lilli

  • new property ‘renderForm’ allows a custom ‘MultiModelRenderForm’ -> luk1999

  • changed update behavior: loads the record from the db by findByPK before update (like default behavior of actionUpdate in a controller)

For those who want help me: mmf on github

luk1999: sorry, have no time to look at foundation3.

But if you take a look at the bootstrap mmf-code, should be possible to support foundation too.

You can make a pull request on github, if you have added foundation support.

zetsubo: sorry, have no time to experiment with nested multimodelforms. please try yourself.

Thanks. Could you also add also ability to define custom MultiModelEmbeddedForm class?

Could you also add params for add button? Something like this:

class MultiModelForm {


     * The htmlOptions for the add link


     * @var array $addHtmlOptions


    public $addHtmlOptions = array();


class MultiModelRenderForm




     * Get the add item link or button


     * @return string


    public function getAddLink()


        if ($this->parentWidget->addItemAsButton)


            echo CHtml::htmlButton(





                        'id' => $this->parentWidget->id,

                        'rel' => '.' . $this->parentWidget->getCopyClass()




        } else


            return CHtml::tag('a',




                        'id' => $this->parentWidget->id,

                        'href' => '#',

                        'rel' => '.' . $this->parentWidget->getCopyClass()








With these modifications using your extension with Foundation should be pretty easy. I’ll write how to do this later.

I try mmf.demo.4.5.zip ,when I added two members in the same group I got this error " Array to string conversion ".What am I missing? Any help please.OK I found the problem now.The problem is the wampserver.But now I want to know how to use bootstrap in form builder.Any idea?

You only have to set ‘bootstrapLayout’=>true.

No need for special bootstrap in the formbuilder for the multimodelform.

See: bootstrap support

For other purposes: Yiibooster supports formbuilder.

Hi All

Great extension, I am very close to make it work 100% for me.

I have been struggling with the checkboxlist. I already made it work when adding a single record, but with multiple new records, it doesnt record the checkboxes as it should.

All the other fields save just fine, the checkbox is the only one giving me trouble.

Heres what I try to save.



Heres what it shows after saving



Any ideas?

Thank you very much.


Do you use the checkbox-list with one checkbox as explained here?


'ostenta_tenencia' => array(

                'type' => 'checkboxlist',

                'items' => array('1' => ' '),


I put a blank space there, but I tried with a word there and same error.

Making further testing. The error is only when first creating additional rows. If I edit the checkboxes within the records already saved, everything works just fine.

And in demo code, if you change it to one checkbox?

I need something, where to reproduce this error.

The demo worked fine with multiple checkboxes, after changing to one checkbox I get

 Array to string conversion 

I can’t reproduce the error in the 4.5 demo and one single checkbox works fine too.

Maybe an issue with the PHP version or Linux/Win ??

Changed in demo:

$memberFormConfig = array(








Tested with ‘tableView’=>true and false - all fine.

PHP version 5.3.6 on Windows 7 (XAMPP Installation).

nakarin had the ‘Array to string conversion’ on WAMPP too. What was the problem? How did he solve it?

In which php-file / line does the error happen?

I think the problem is WAMPP wampserver2.2e-php5.4.3-httpd2.2.22-mysql5.5.24-32bit/Windows 7 ,so I changed to xampp-win32-1.7.4-VC6-installer/Windows 7 and the problem 's gone.Thanks for your great extension,Cheers.

Has anyone been able to integrate this extension with TinyMCE so that textarea fields are output as wysiwyg editors?