我徘徊驗證規則是否有任何機會,以使用規則的情況下,場景在警予
在我的模型我有
public function rules()
{
return array(
array('delivery, firstNameBilling, lastNameBilling, addressBilling, cityBilling, countryBilling,
postBilling, telephoneBilling, mailBilling, firstNameDelivery, lastNameDelivery, addressDelivery,
cityDelivery, countryDelivery, postDelivery, telephoneDelivery, mailDelivery', 'required'),
array('active', 'numerical', 'integerOnly'=>true),
);
}
在我看來,我有這樣的事情
<tr>
<td>
<p><?php echo $form->label($model,'telephoneBilling'); ?><span>: </span><span class="required">*</span></p>
</td>
<td>
<?php echo $form->textField($model,'telephoneBilling'); ?>
<?php echo $form->error($model,'telephoneBilling'); ?>
</td>
</tr>
</table>
<p><?php echo $form->checkBox($model,'active', array('class' => 'change')); ?>
Delivery information: Please check the box if your delivery address differs from your billing address and enter the
required delivery address in the fields provided below.</p>
<div id="deliveryFormWrapper" style="display: none">
<table class="cartReviewTable">
<tr>
<td colspan="4">
<span class="blueTitle"><?php echo CHtml::encode(Yii::t('app', 'Delivery Information ')); ?></span>
</td>
</tr>
<tr>
<td>
<p><?php echo $form->label($model,'firstNameDelivery'); ?><span>: </span><span class="required">*</span></p>
</td>
<td>
<?php echo $form->textField($model,'firstNameDelivery'); ?>
<?php echo $form->error($model,'firstNameDelivery'); ?>
</td>
這只是給你一個圖片我做什麼的一部分,所以當我點擊複選框時,我顯示這個隱藏的div,並且他有一個規則爲他的領域(第一個div包含計費領域,隱藏contai ns發貨字段。
當我想提交表單,並沒有選中該複選框,我不能這樣做,因爲需要的領域,所以我是遊蕩 是否有機會使用場景對於這種情況怎麼樣,我需要一個線索。
謝謝,我希望你能理解我的問題。
http://www.yiiframework.com/wiki/266/understanding-scenarios/ – 2013-07-02 08:07:33