Change the line 942 (v. 3.0) in the method 'renderTableHeader()'-
foreach ($this->getElements() as $element)
if ($element->visible && $element->type != 'hidden') //<-- add condition for type not 'hidden'
{
Posted 23 February 2012 - 12:24 PM
foreach ($this->getElements() as $element)
if ($element->visible && $element->type != 'hidden') //<-- add condition for type not 'hidden'
{
Posted 23 February 2012 - 12:29 PM
Joblo, on 15 December 2011 - 06:35 AM, said:
$this->widget('ext.jqrelcopy.JQRelcopy',array( //or multimodelform
...
'options'=>array('append'=>CHtml::tag('span',array('class'=>'hint')),
...
$memberFormConfig = array(
'elements'=>array(
'firstname'=>array(
'type'=>'text',
'maxlength'=>40,
),
'<hr/>', //<--add html-code as string to the elements array
CHtml::tag('span',array('class'=>'hint')), //<-- string
...
));
$perfreviewsubFormConfig = array(
'elements'=>array(
'standardname'=>array(
'id'=>'standardid',
'label'=>'Standard',
'type'=>'textarea',
'rows'=>'6',
'cols'=>'30',
'disabled'=>'disabled',
'resize'=>'none'
),
'<hr>', //<--add html-code as string to the elements array
'elementname'=>array(
'label'=>'Element',
'type'=>'textarea',
'rows'=>'5',
'cols'=>'30',
'disabled'=>'disabled',
),
'ratingid'=>array(
'type'=>'radiolist',
'items'=>PerfReview::model()->getRatingOptions(),
//'prompt'=>'Please Select Rating:',
),
));
Posted 23 February 2012 - 01:28 PM
protected function renderFormElements()
{
$output = '';
$elements = $this->getElements();
foreach ($elements as $element)
{
if (isset($element->name)) //element is an attribute of the model
{
$elemName = $element->name;
...
}
}
else //CFormStringElement... Bugfix in the next release
$output .= $element->render();
Posted 24 February 2012 - 02:53 AM
Posted 24 February 2012 - 05:23 AM
Joblo, on 23 February 2012 - 12:24 PM, said:
foreach ($this->getElements() as $element)
if ($element->visible && $element->type != 'hidden') //<-- add condition for type not 'hidden'
{
Posted 27 February 2012 - 05:17 PM
ragua, on 24 February 2012 - 02:53 AM, said:
Posted 28 February 2012 - 03:13 AM
Posted 29 February 2012 - 03:50 AM
Posted 04 March 2012 - 09:48 PM
Loren, on 28 June 2011 - 03:10 PM, said:
Screen shot 2012-03-05 at 9.34.21 AM.png (165.85K)
Screen shot 2012-03-05 at 9.43.41 AM.png (180.1K)
Posted 05 March 2012 - 12:26 PM
Posted 06 March 2012 - 07:29 AM
Posted 06 March 2012 - 11:26 AM
Joblo, on 06 March 2012 - 07:29 AM, said:
public function actionUpdate($id)
{
Yii::import('ext.multimodelform.MultiModelForm');
$model=$this->loadModel($id); //The Performance Review model
$perfreviewsub = new PerfReviewSub;
$validatedPerfreviewsub = array(); //ensure an empty array
// Uncomment the following line if AJAX validation is needed
$this->performAjaxValidation($model,$perfreviewsub);
if(isset($_POST['PerfReview']))
{
$model->attributes=$_POST['PerfReview'];
//the value for the foreign key 'performancereviewid'
$masterValues = array ('performancereviewid'=>$model->performancereviewid);
if(//Save the parent model after saving child sub records
MultiModelForm::save($perfreviewsub,$validatedPerfreviewsub,$deletePerfreviewsub,$masterValues) &&
$model->save()
)
$this->redirect(array('update','id'=>$model->performancereviewid));
}
$this->render('update',array(
'model'=>$model,
//submit the sub and validatedItems to the widget in the edit form
'perfreviewsub'=>$perfreviewsub,
'$validatedPerfreviewsub' => $validatedPerfreviewsub,
));
}$perfreviewsubFormConfig = array(
'elements'=>array(
'standardname'=>array(
'id'=>'standardid',
'label'=>'Standard',
'type'=>'textarea',
'rows'=>'4',
'cols'=>'65',
'disabled'=>'disabled',
'resize'=>'none'
),
'elementname'=>array(
'label'=>'Element',
'type'=>'textarea',
'rows'=>'4',
'cols'=>'65',
'disabled'=>'disabled',
),
'ratingid'=>array(
'type'=>'radiolist',
'items'=>PerfReview_Admin::model()->getRatingOptions(),
//'prompt'=>'Please Select Rating:',
),
));
$this->widget('ext.multimodelform.MultiModelForm',array(
'id' => 'id_perfreviewsub2', //the unique widget id
'tableView' => true,
'formConfig' => $perfreviewsubFormConfig, //the form configuration array
'model' => $perfreviewsub, //instance of the form model
//if submitted not empty from the controller,
//the form will be rendered with validation errors
'validatedItems' => $validatedPerfReviewSub,
//array of perfreviewsub instances loaded from db
'data' => $perfreviewsub->findAll('(performancereviewid=:performancereviewid) order by standardid, elementid', array(':performancereviewid'=>$model->performancereviewid)),
));
Posted 06 March 2012 - 11:59 AM
Posted 06 March 2012 - 12:40 PM
Joblo, on 06 March 2012 - 11:59 AM, said:
Posted 06 March 2012 - 11:25 PM
<?php
// see http://www.yiiframework.com/doc/guide/1.1/en/form.table
// Note: Can be a route to a config file too,
// or create a method 'getMultiModelForm()' in the member model
$itemFormConfig = array(
'elements'=>array(
'item'=>array(
'type'=>'text',
'maxlength'=>50,
),
'bringing'=>array(
'type'=>'text',
'maxlength'=>32,
),
'otherOpt'=>array(
'type'=>'checkbox',
),
'other'=>array(
'type'=>'text',
'maxlength'=>50,
),
'order'=>array(
'type'=>'text',
'maxlength'=>3,
'size'=>2
),
)
);
$this->widget('ext.multimodelform.MultiModelForm',array(
'id' => 'id_items', //the unique widget id
'formConfig' => $itemFormConfig, //the form configuration array
'model' => $item, //instance of the form model
//if submitted not empty from the controller,
//the form will be rendered with validation errors
'validatedItems' => $validItems,
'tableView' => true,
//array of member instances loaded from db
'data' => $item->findAll(array(
'condition' => 'menu_id=:menuId',
'params' => array(':menuId'=>$model->id),
'order' => '`order` asc'
)),
));
?>
menu2.zip (745.77K)
family-sql.txt (1.79K)
Posted 07 March 2012 - 04:10 PM
Joblo, on 06 March 2012 - 11:59 AM, said:
//if sortable, assign the sortAttribute
if (!empty($sortAttribute))
{
$sortIndex++;
$item->$sortAttribute = $sortIndex;
}
print_r($item);
if (!$item->save())
return false;
Posted 07 March 2012 - 05:13 PM
Posted 07 March 2012 - 05:26 PM
Posted 07 March 2012 - 05:34 PM
Joblo, on 07 March 2012 - 05:13 PM, said:
Posted 07 March 2012 - 08:25 PM
Joblo, on 07 March 2012 - 05:26 PM, said:
family-sql.txt (1.79K)