[EXTENSION] multimodelform/jqrelcopy

I have released v3.0 with the new property $showAddItemOnError (default: true).

Set this to false and let me know if it works for you.

Is (multiple) file upload feature supported in version 3 ?

(BTW, yes $showAddItemOnError works great for me, thanks for this great extension)

Sorry for the delay…

The multiple file upload feature is not supported in 3.0, it was not in my mind when working on 3.0.

But maybe (not tested) you can merge this solution with the original code.

Hello:

Thanks. I will be able to test the new $showAddLink property in my next project. I can’t test it now because I already modified the extension to completely hide the new blank item form on an error and just show the invalid data. Due to time constraints I did not fully document my steps, but can revisit it upon your request.

One new issue is conditional form config depending upon row data, like showing a drop down on a field if the row’s usertype is admin, or a normal text input on the field if the row’s usertype is a signup.

To fix this I just wrote a jquery each function to cycle through each of the elements, and a parent.find() to retrieve the other element’s value. Then it was simple to update the drop down.

hi, good extension

i have a problem with the id passed from group (RegistroFactura) to member (OrdenTrabajo), when i try to save the error summary say "groupid cannot be blank"

can anybody helpme

heres is my create method


public function actionCreate() {            

                Yii::import('ext.multimodelform.MultiModelForm');

                

		$model = new RegistroFactura;

                

                $model_ot = new OrdenTrabajo();

                

                $validatedOt = array();

                

		if (isset($_POST['RegistroFactura'])) {

			$model->attributes=$_POST['RegistroFactura'];

                        

                        if(MultiModelForm::validate($model_ot,$validatedOt,$deletedItems) && $model->save()) {

                            

                            $masterValues = array('id_rf' => $model->id);

                            

                            if (Yii::app()->getRequest()->getIsAjaxRequest())

                            {

                                Yii::app()->end();

                            }

				else

                                {

                                    if(MultiModelForm::save($model_ot,$validatedOt,$deletedItems,$masterValues))

                                    {

                                        $this->redirect(array('view', 'id' => $model->id));

                                    }

                                }

			}

		}


		$this->render('create', array(

				'model' => $model,

                                'model_ot' => $model_ot,

                                'validatedOt' => $validatedOt,

				));

	}

Seems you have set the groupid (RegistroFactura) to "required". So the MultiModelForm::validate will add the error.

Try to set the groupid to 0 before validating the model.





public function actionCreate() {            

                Yii::import('ext.multimodelform.MultiModelForm');

                

                $model = new RegistroFactura;

                

                $model_ot = new OrdenTrabajo();

                

                $validatedOt = array();

                

                if (isset($_POST['RegistroFactura'])) {

                        $model->attributes=$_POST['RegistroFactura'];

                        

                        $model->groupid = 0; //<-- add this


                        if(MultiModelForm::validate($model_ot,$validatedOt,$deletedItems) && $model->save()) {

                            

                           ...

        }




Or see this topic if it’s an issue of the detail-table.

thks joblo i delete the require condition and it works

Someone have an example using multimodelform for something like this

one member can have many profiles

the group, members and profiles only in 1 form

the problem maybe is to create a good relation between profile and member, because the members are dynamically created

Sorry for my english, im from CHILE

Maybe the just released extension wform can help you.

i try it, but i dont understand the extension :s,

there is no possible with multimodelform extension?

Sorry, I don’t see a possibility to manage all 3 tables in one form with this extension out of the box :frowning:

Hi,

i’ve posted a topic in the main forum, but it may be a problem related to multimodel:

My link

Thanks for helping me.

Thank you for the awesome extension and your contributions to your users. Extremely helpful.

relCopy has a limit option. Using the group/members example I’m able to pass this option, but the results aren’t what I was hoping for. It seems that the limit is reset after the page reloads. So say the limit is 5, I can add four rows (total of five if we count the initial blank row), save, then come back and add another 5 rows. The desired behavior is that once I reach x number of rows, I can no longer add rows and there are no blank rows on load.

Anyone with a suggestion as to how I could make the limit option work, especially after reload? It seems like I could somehow count the rows and add or not based on that count versus the limit setting. I’m not strong with jquery (or javascript in general) so any help is greatly appreciated.

I didn’t take care about the ‘limit’ property.

It should be an easy exercise to hide the ‘Add item’ link and the ‘empty row’, if the limit is reached on showing the records.

But the problem is, if the ‘delete’ link of each row has to be still visible.

When the user deletes a row (so the limit is not reached), a javascript workaround is necessary to show the ‘Add item’ and the empty input.

And this is not so easy to implement…

Hi,

when datas are shown in tableview mode, key fields always appears, even if the correspondant field value is hidden.

It works fine in normal view.

Tought the issues with hidden fields have been fixed with the last release.

Can you tell more details: your formConfig, your fields, how are they defined as hidden …

Here’s my config:




<!-- ajout multimodel --> 

	<?php   $relStudentClassFormConfig = array(

      'elements'=>array(

// lorsqu'on n'est pas en mode tableView, inutile d'afficher class_id (mais en tableview il faut le faire, il y a un bug a l'affichage)

// question posee sur le forum yii

        'class_id'=>array(

//            'type'=>'hidden',

        	'value'=>$model->class_id,

        	'default'=>$model->class_id,

        ),

// modif affichage student_id

/*        'student_id'=>array(

            'type'=>'text',

        ), */

        'student_id'=>array(

          	'type'=>'dropdownlist',

			'items' => $data2,

        ), 

// fin modif affichage student_id

              'class_status'=>array(

            'type'=>'dropdownlist',

			'items'=>array(0=>'---',1=>'présent',2=>'absent'),

        ),

    )); ?>

	<?php $this->widget('ext.multimodelform.MultiModelForm',array(

	    'tableView'=>true, // true: permet d'avoir les donnees affichees horizontalement

        'id' => 'class_id', //the unique widget id

        'formConfig' => $relStudentClassFormConfig, //the form configuration array

        'model' => 'relStudentClass', //instance of the form model

        'validatedItems' => $validatedRelStudentClass,

        'showAddItemOnError' => false, // permet de ne pas ajouter une nouvelle occurrence de relStudentClass si celle en cours est en erreur

		'data' => empty($validatedItems) ? $relStudentClass->findAll(

				array('condition'=>'class_id=:classId',

				'params'=>array(':classId'=>$model->class_id),

		)) : null,

    )); ?>

<!-- fin ajout multimodel --> 



the problem is the field class_id.

I made capture of using hidden line or not.

I used multimodelform 3.0 but modify some code (i wanted no "add item" for my form).

Hope these elements will help you to help me!

Hi, Thanks for the extension!

I am hoping someone can tell me how to do the following:

I went through the code of the multimodelform.php, but couldn’t find a way to not display the “Add Record” or “Remove” links. I am pre-populating the form with static data, so there is no need to display them. Can you tell me how to remove those links?

Also, I do not need an empty record at the end of the form. Is there a way to not display that either?

Any help would be appreciated.

Thanks!

Hi, can you show\explain how you did this? I would like that functionality as well, but my scripting is limited by my knowledge.

Thanks!