yii中的Onsubmit调用函数

yii中的Onsubmit调用函数,yii,Yii,我想在yii中提交表单时调用函数。在我的表单中,我启用了validateOnSubmit 当以调用函数形式提交时,表示它将调用函数两次 我的编码 <?php $form = $this->beginWidget('CActiveForm', array( 'id' => 'question-form', // Please note: When you enable ajax validat

我想在yii中提交表单时调用函数。在我的表单中,我启用了
validateOnSubmit

当以调用函数形式提交时,表示它将调用函数两次

我的编码

<?php
            $form = $this->beginWidget('CActiveForm', array(
                'id' => 'question-form',
                // Please note: When you enable ajax validation, make sure the corresponding
                // controller action is handling ajax validation correctly.
                // There is a call to performAjaxValidation() commented in generated controller code.
                // See class documentation of CActiveForm for details on this.
                'enableAjaxValidation' => true,
                'enableClientValidation' => false,
                'clientOptions' => array(
                    'validateOnSubmit' => true,
                    'validateOnChange' => false,
                ),
                'htmlOptions' => array('onsubmit' => 'return checkmultiple()',),

            ));
            ?>


            <div class="form-group">
                <?php echo $form->labelEx($model, 'question_title'); ?>
            <?php echo $form->textField($model, 'question_title', array('size' => 50, 'maxlength' => 250, 'class' => 'form-control')); ?>
            <?php echo $form->error($model, 'question_title'); ?>
            </div>
                <?php if ($tileAssigned == Yii::app()->const->FLAG_ZERO) { ?>
                <div class="form-group">
                    <?php echo $form->labelEx($model, 'type', array('label' => 'Is Multiple Choice')); ?>
<?php echo $form->radioButtonList($model, 'type', $yesnoList, array('separator' => '', 'onchange' => 'questionTypeChange(this.value);', 'class' => '')); ?>
                <?php echo $form->error($model, 'type'); ?>
                </div>

您的问题在哪里?如何一次调用checkmultiple函数?因为现在该函数调用两次?beforeValidate()或afterValidate()选项是否有用?制作
ajaxSubmitButton
并在那里调用它,或者在控制器中检查post中的表单参数。
function checkmultiple()
{
}