Hi, I am using ajaxSubmitButton to submit a form. I want to know how to validate the form in client-side, I mean just use js, rather than server-side ajax.
I’m digging for a long time, still cannot figure it out. Please help me!!!
Below is the form
<?php $form = $this->beginWidget('GxActiveForm', array(
'id' => 'questions-form',
'enableAjaxValidation' => false,
));
foreach ($questions as $question):
?>
<li>
<p><?php echo $question['description'];?></p>
<?php foreach ($question['options'] as $option) :?>
<label class="radio">
<input type="radio" name='<?php echo "q".$question["id"];?>' id='<?php echo "q".$question["id"];?>' value='<?php echo $option["opt"]?>'>
<?php echo $option['val'];?>
</label>
<?php endforeach;?>
<hr>
</li>
<?php endforeach;?>
<input type="hidden" name="quiz_id" value="<?php echo $quiz_id;?>">
<?php
echo GxHtml::ajaxSubmitButton(
Yii::t('app', 'Submit'),
CController::createUrl('quizSubmit'),
array(
'update' => '#content-swap'
),
array('class'=>'btn', 'id'=>'qz'.uniqid()));
$this->endWidget();
?>