Compare rule in tabular input is not working.
Model class
class CustomReference extends Reference {
public $retypeEmail;
public function rules() {
return(array_merge(parent::rules(), array(
array('retypeEmail', 'safe'),
array('retypeEmail', 'email'),
array('retypeEmail', 'compare', 'compareAttribute' => 'rf_email'),
)));
}
public function attributeLabels() {
return(array(
'rf_code' => Yii::t('app', 'Rerence Code'),
'rf_contact' => Yii::t('app', 'Reference Contact'),
'rf_description' => Yii::t('app', 'Reference Description'),
'rf_phone' => Yii::t('app', 'Reference Phone'),
'rf_cellphone' => Yii::t('app', 'Reference Cellphone'),
'rf_email' => Yii::t('app', 'Reference Email'),
'rf_sp_code' => Yii::t('app', 'Reference Sp Code'),
'rf_creationDate' => Yii::t('app', 'Reference Creation Date'),
'rf_updateDate' => Yii::t('app', 'Reference Update Date'),
'rf_user' => Yii::t('app', 'Reference User'),
'rf_type' => Yii::t('app', 'Reference Type'),
'retypeEmail' => Yii::t('magistral', 'Retype Reference Email'),
));
}
}
View
foreach ($references as $reference) {
if ($i % 2 == 0)
echo '<div class="span12 margin-bottom-50">';
echo '<div class="span6">';
echo $form->textFieldRow($reference, "[$i]rf_contact", array('hint' => Yii::t('magistral', 'Introduce the name contact of the company'), 'class' => 'width-80-percent', 'labelOptions' => array('class' => 'bold-text')));
echo $form->maskedTextFieldRow($reference, "[$i]rf_phone", '(+999)999-9999999)', array('hint' => Yii::t('magistral', 'Introduce the phone number like (+999)999-999999'), 'class' => 'width-80-percent', 'labelOptions' => array('class' => 'bold-text')));
echo $form->textFieldRow($reference, "[$i]rf_email", array('hint' => Yii::t('magistral', 'Introduce the email like example@provide.com'), 'class' => 'width-80-percent', 'labelOptions' => array('class' => 'bold-text')));
echo $form->textFieldRow($reference, "[$i]retypeEmail", array('hint' => Yii::t('magistral', 'Retype the email like example@provide.com'), 'class' => 'width-80-percent', 'labelOptions' => array('class' => 'bold-text')));
echo $form->hiddenField($reference, "[$i]rf_type", array());
echo '</div>';
if ($i % 2 != 0)
echo '</div>';
$i++;
}