Yii Framework Forum: [EXTENSION] multimodelform/jqrelcopy - Yii Framework Forum

Jump to content

  • (14 Pages)
  • +
  • « First
  • 4
  • 5
  • 6
  • 7
  • 8
  • Last »
  • You cannot start a new topic
  • You cannot reply to this topic

[EXTENSION] multimodelform/jqrelcopy Solutions for clientside cloning Rate Topic: ***** 4 Votes

#101 User is offline   Joblo 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 666
  • Joined: 12-September 10
  • Location:Austria

Posted 20 December 2011 - 07:34 PM

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.
0

#102 User is offline   Michel Kogan 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 21
  • Joined: 28-February 11

Posted 30 December 2011 - 03:31 PM

View PostJoblo, on 20 December 2011 - 07:34 PM, said:

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)
0

#103 User is offline   Joblo 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 666
  • Joined: 12-September 10
  • Location:Austria

Posted 05 January 2012 - 04:40 AM

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.
0

#104 User is offline   urgent 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 19
  • Joined: 20-July 11

Posted 06 January 2012 - 04:51 PM

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.
0

#105 User is offline   urgent 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 19
  • Joined: 20-July 11

Posted 09 January 2012 - 11:59 AM

View Posturgent, on 06 January 2012 - 04:51 PM, said:

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.
0

#106 User is offline   Nymphetamine 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 9
  • Joined: 13-January 12

Posted 17 January 2012 - 01:50 PM

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,
				));
	}

0

#107 User is offline   Joblo 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 666
  • Joined: 12-September 10
  • Location:Austria

Posted 18 January 2012 - 03:06 AM

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.
0

#108 User is offline   Nymphetamine 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 9
  • Joined: 13-January 12

Posted 18 January 2012 - 07:47 AM

thks joblo i delete the require condition and it works
0

#109 User is offline   Nymphetamine 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 9
  • Joined: 13-January 12

Posted 18 January 2012 - 09:29 AM

Someone have an example using multimodelform for something like this

Posted Image

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
0

#110 User is offline   Joblo 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 666
  • Joined: 12-September 10
  • Location:Austria

Posted 18 January 2012 - 10:06 AM

Maybe the just released extension wform can help you.
0

#111 User is offline   Nymphetamine 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 9
  • Joined: 13-January 12

Posted 19 January 2012 - 08:09 AM

View PostJoblo, on 18 January 2012 - 10:06 AM, said:

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?
0

#112 User is offline   Joblo 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 666
  • Joined: 12-September 10
  • Location:Austria

Posted 20 January 2012 - 04:02 AM

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

#113 User is offline   ragua 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 135
  • Joined: 23-January 12
  • Location:Paris - France

Posted 30 January 2012 - 06:43 AM

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.
0

#114 User is offline   posman71 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 1
  • Joined: 18-November 11

Posted 11 February 2012 - 12:26 AM

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.
0

#115 User is offline   Joblo 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 666
  • Joined: 12-September 10
  • Location:Austria

Posted 12 February 2012 - 04:20 AM

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...
0

#116 User is offline   ragua 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 135
  • Joined: 23-January 12
  • Location:Paris - France

Posted 21 February 2012 - 03:13 AM

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.
0

#117 User is offline   Joblo 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 666
  • Joined: 12-September 10
  • Location:Austria

Posted 21 February 2012 - 05:31 AM

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 ...
0

#118 User is offline   ragua 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 135
  • Joined: 23-January 12
  • Location:Paris - France

Posted 21 February 2012 - 07:00 AM

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!

Attached File(s)


0

#119 User is offline   Th3 R00ST3R 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 19
  • Joined: 07-February 12

Posted 23 February 2012 - 12:18 PM

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!
0

#120 User is offline   Th3 R00ST3R 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 19
  • Joined: 07-February 12

Posted 23 February 2012 - 12:20 PM

View Posturgent, on 09 January 2012 - 11:59 AM, said:

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, can you show\explain how you did this? I would like that functionality as well, but my scripting is limited by my knowledge.

Thanks!
0

Share this topic:


  • (14 Pages)
  • +
  • « First
  • 4
  • 5
  • 6
  • 7
  • 8
  • Last »
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users