Yii Framework Forum: Help With The Multimodelform (Form Design) - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Help With The Multimodelform (Form Design) Rate Topic: -----

#1 User is offline   spiderbbc 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 2
  • Joined: 18-March 13

Posted 07 April 2013 - 04:13 PM

Help With The Multimodelform (form design)


Yii Framework good community with my problem is that I can not MultimodelForm and sort my text boxes for my application

if anyone can help me with some code and I've tried everything with no solution

I would like to sort my boxes and on top of my application

Annex code for my views:


$memberFormConfig = array(
	'showErrorSummary' => true,	
    'elements'=>array(
        
          
        
			
				
   			  'asociado_id'=>array(
                'type'=>'text',
				
                'size'=>'20',
                'maxlength'=>'40',
 				//'STYLE'=>'text-align:center',
                'id'=>'asociado_id',
				//'style'=>'color:white; background-color:LightSlateGray; font-size: small',
				//'size'=>105,
				'class'=>'form',
            ), 
            'dependecia'=>array(
                'type'=>'text',
                'size'=>'20',
                'maxlength'=>'50',
                'id'=>'dependecia',
            ),
          
            'direccion_trabajo'=>array(
                'type'=>'text',
                'id'=>'direccion_trabajo',
		'maxlength'=>100,
                
            ),

 		 'ubicacion_admin'=>array(
                'type'=>'text',
                'id'=>'ubicacion_admin',
                'size'=>'20',
				'maxlength'=>40,
                
            ),
'estado_id'=>array(
                'type'=>'dropdownlist',
            	//'items'=>array(''=>'Seleccione',1=>'Distrito Capital',2=>'Miranda',3=>'Sucre'), /// valor=>campo
                'items'=>CHtml::listData(CahorEstado::model()->findAll(),'id','Estado'),
            	'prompt'=>'--please select--',
                        'ajax'=>array(
                                                        'type'=>'POST',
                                                        'url'=>CController::createUrl('dynamicestado'),
                                                        'update'=>'#ciudad_id',//.CHtml::activeId($modelb,'ciudad_id'),
            											'data'=>array('estado_id'=>'js:this.value'),
                                                        )    
            
            
            	//'id'=>'estado_id',
               // 'size'=>'20',
		//'maxlength'=>40,
                
            ),

		
 		 'ciudad_id'=>array(
                'type'=>'dropdownlist',
            	 'items'=> CHtml::listData(CahorCiudad::model()->findAll(),'id','ciudad'), /// valor=>campo
            	 'id'=>'ciudad_id',
         		'prompt'=>'Selecione',
            	'ajax'=>array(
            	'type'=>'POST',
            	//'update'=>'#'.CHtml::activeId($modelb,'estado_id'),
            
            
            
            
            )
            	//'data'=>array('ciudad_id'=>'js:this.value'),
               // 'size'=>'20',
			  //'maxlength'=>40,
                
            ),
            
 

'zona'=>array(
                'type'=>'text',
                'id'=>'zona',
                'size'=>'20',
		'maxlength'=>40,
                
            ),

'cargo'=>array(
                'type'=>'text',
                'id'=>'cargo',
                'size'=>'20',
		'maxlength'=>40,
                
            ),

'tipo_id'=>array(
                'type'=>'text',
                'id'=>'tipo_id',
                'size'=>'20',
		'max	length'=>40,
                
            ),

'fecha_ingr_cahor'=>array(
                'type'=>'zii.widgets.jui.CJuiDatePicker',
                'id'=>'fecha_ingr_cahor',
            	'language'=>'es',
            	'options'=>array(
            	'value'=>$modelb->fecha_ingr_cahor,
                'showAnim'=>'fold',
              //  'size'=>'20',
		        //'maxlength'=>40,
                
            ))	,

'sueldo_salario_men'=>array(
                'type'=>'text',
                'id'=>'sueldo_salario_men',
                'size'=>'20',
		'max	length'=>20,
                
            ),

'telefono'=>array(
                'type'=>'text',
                'id'=>'telefono',
                'size'=>'20',
				'maxlength'=>20,
            	
               'style'=>'height:80px;'
                                 
                
            ),





        ));





	$this->widget('ext.multimodelform.MultiModelForm',array(
        'id' => 'id_CahorDatoslaboasociado', //the unique widget id
         'tableView' => false,
        'formConfig' =>$memberFormConfig , //the form configuration array
        'model' => $modelb, //instance of the form model
 		'hideCopyTemplate'=>true,    //Mantiene Abierto la mitad del formulario
		'addItemText'=>'Añadir Datos laborales del Asociado',
		'removeText'=> 'Borrar',
		'removeConfirm' => '¿Seguro desea borrar el Registro?',
	    'options'=>array('clearInputs'=>true),
        //if submitted not empty from the controller,
        //the form will be rendered with validation errors
        'validatedItems' => $validatedCahorDatoslaboasociado,
		//'showAddItemOnError' => true,
		
		
 
        //array of member instances loaded from db
        'data' => $modelb->findAll('id=:id', array(':id'=>$model->id)),
    ));



?>


to store and update I have no problem but I only need to sort the boxes if anyone has an idea how to order they are grateful .. thanks

Attached File(s)


0

#2 User is offline   Ghanshyam 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 41
  • Joined: 18-March 13
  • Location:Ahmedabad

Posted 08 April 2013 - 01:16 AM

hi,
if you are using other model field in your form, so you must have to define that field name in your model. then if you get all form data in post in controller. you can set all the data in particular model field.

table1 3-field = id,firstname,lastname
if you want to other fild want to use in form so define in table1 model like

table1(model)
public $city


city field of table2.

then you get form submit data in post so set city in table2 model.

Thanks.
0

#3 User is offline   spiderbbc 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 2
  • Joined: 18-March 13

Posted 08 April 2013 - 10:39 AM

View PostGhanshyam, on 08 April 2013 - 01:16 AM, said:

hi,
if you are using other model field in your form, so you must have to define that field name in your model. then if you get all form data in post in controller. you can set all the data in particular model field.

table1 3-field = id,firstname,lastname
if you want to other fild want to use in form so define in table1 model like

table1(model)
public $city


city field of table2.

then you get form submit data in post so set city in table2 model.

Thanks.



thanks for the reply but actually I have no problem as the data I'm sending my only problem is visual, and I just want to sort the boxes and in the top of my form but the extention MultimodelForm that I'm using to save the second not sorted model as text boxes represents MultimodelForm lower as text boxes this way.

$ memberFormConfig = array (
       'elements' => array (
         'Associate' => array (
             'type' => 'text',
             'maxlength' => 40,
            'htmlOptions' => '<br> </ br>' does not work
         )


I have not really found any information on how to order the text boxes
0

Share this topic:


Page 1 of 1
  • 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