hi Jonah,
yes it does take scenario into account … (previous version did already). What happen is that just after the call to form() you can call setScenario(scenationName) so the extension will only select validators which are part of this scenario.
For instance :
<?php
$CS=Yii::app()->jformvalidate;
echo $CS->form();
$CS->setScenario("form7"); // set scenario name here
?>
<?php echo CHtml::errorSummary($model);?>
<div class="container errorSummary" style="display:none">
<p>Please fix the following input errors:</p>
<ul>
</ul>
</div>
<div class="simple">
<?php echo CHtml::activeLabel($model,'email'); ?>
<?php echo $CS->activeTextField($model,'email') ?>
</div>
<div class="action">
<?php echo CHtml::submitButton('Submit'); ?>
</div>
<?php echo $CS->endForm(); ?>
</form>
Actually the archive comes with a sample (controller+model+view) that are using scenario based validation (take a look at the TestForm Model class.
However, I’ve realized it is missing some rule that is common to all yii built-in validator : allowEmpty (shame on me
) This will be implemented in a future release …
![]()