Answer the question
In order to leave comments, you need to log in
How to validate table input data in Yii?
Hello! I use www.eha.ee/labs/yiiplay/index.php/et/site/extensio... . Added a widget to the form:
<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>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question