Answer the question
In order to leave comments, you need to log in
How to solve problem with Yii forms?
Good afternoon. There was a problem with the forms, namely, I can’t figure out how to make the js code connect.
If you create a form on the same page, then everything will work.
https://yadi.sk/i/ZM_i0iikhnLwB
But my task is to create a form dynamically, via ajax. Let's say we add the code below to the page via ajax:
<?php $form = $this->beginWidget('UActiveForm', array(
'id' => 'service-order-form-data',
'enableAjaxValidation' => true,
'clientOptions' => array(
'validateOnSubmit' => true,
'beforeValidate'=>'js:formServiceBeforeValidate',
'afterValidate'=>'js:formServiceAfterValidate',
'inputContainer' => 'fieldset',
'successCssClass' => 'b-form-correct-fieldset',
'errorCssClass' => 'b-form-wrong-fieldset',
'validatingCssClass' => 'b-form-processed-fieldset',
),
'htmlOptions' => array(
'class' => 'b-form b-order-form g-cleared',
),
)); ?>
<fieldset class="b-form-fieldset b-form-required-fieldset">
<?php echo $form->labelEx($dataOrder, 'comment', array('class' => 'b-form-fieldset-description')); ?>
<?php echo $form->textArea($dataOrder, 'comment', array('class' => 'b-form-fieldset-text-input', 'style' => 'height: 100px')); ?>
<?php echo $form->error($dataOrder, 'comment', array('class' => 'b-form-fieldset-error')); ?>
</fieldset>
<fieldset class="b-form-fieldset b-form-submit-fieldset">
<input class="b-form-fieldset-submit-input" id="store-order-form-canceled-submit" type="submit">
</fieldset>
<?php $this->endWidget(); ?>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question