Здравствуйте! использую
www.eha.ee/labs/yiiplay/index.php/et/site/extensio... . Добавил виджет в форму :
<div class="form">
<?php echo CHtml::beginForm('/questions/'. Yii::app()->controller->action->id,'post',array('id'=>'question-form')
); ?>
<?php echo CHtml::errorSummary($model); ?>
<div class="row">
<?php echo CHtml::activeLabel($model,'firstName'); ?>
<?php echo CHtml::activeTextField($model,'firstName'); ?>
<?php echo CHtml::error($model,'firstName'); ?>
</div>
<div class="row">
<?php echo CHtml::activeLabel($model,'phone'); ?>
<?php echo CHtml::activeTextField($model,'phone'); ?>
<?php echo CHtml::error($model,'phone'); ?>
</div>
<div class="row">
<?php echo CHtml::activeLabel($model,'email'); ?>
<?php echo CHtml::activeTextField($model,'email'); ?>
<?php echo CHtml::error($model,'email'); ?>
</div>
<div class="row">
<?php
$Questions=array(
Questions::model()->findbyPk(1),
);
$this->widget('ext.tabularinput.XTabularInput',array(
'models'=>$Questions,
//'inputLimit'=>10, // comment in to limit the number of input rows
'containerTagName'=>'table',
'headerTagName'=>'thead',
'header'=>'
<tr>
<td>код товара</td>
<td>кол-во</td>
<td></td>
</tr>
',
'inputContainerTagName'=>'tbody',
'inputTagName'=>'tr',
'inputView'=>'/questions/_RequetAvailability_add_filelds',
'inputUrl'=>$this->createUrl('questions/addFieldsForRequetAvailability'),
'addTemplate'=>'<tbody><tr><td colspan="3">{link}</td></tr></tbody>',
'addLabel'=>Yii::t('ui','Add new row'),
'addHtmlOptions'=>array('class'=>'blue pill full-width'),
'removeTemplate'=>'<td>{link}</td>',
'removeLabel'=>Yii::t('ui','Delete'),
'removeHtmlOptions'=>array('class'=>'red pill'),
));
?>
</div>
<?php echo CHtml::endForm(); ?>
</div>
и соответсвенно вьюшка с добавляемыми полями:
<td>
<?php echo CHtml::activeTextField($model,"[$index]productCode"); ?>
<?php echo CHtml::error($model,"[$index]productCode"); ?>
</td>
<td>
<?php echo CHtml::activeTextField($model,"[$index]count"); ?>
<?php echo CHtml::error($model,"[$index]count"); ?>
</td>
<td>
<?php echo CHtml::activeCheckBox($model,"[$index]replacement"); ?>
</td>
Но валидация добавляемых полей не работает...