When adding and removing error messages, I want to resize the entire form. (Via javascript)

If I use crutches (I look at the appearance of these messages (divs), etc.), then it turns out to be an out of sync, adding a delay ( setTimeout ) does not help much.

I stuck my function so far in /framework/web/js/source/jquery.yiiactiveform.js where the code is executed when these messages appear (3 places) - everything is perfect.

 <?php $activeform = $this->beginWidget('CActiveForm', array( 'id'=>'form', 'enableAjaxValidation' => true, 'enableClientValidation' => true, 'clientOptions'=>array( 'validateOnSubmit' => true, 'validateOnChange' => true, ), )); 
  • Please add the elements of your code. At least how you form these errors, why they are displayed, and what mechanism they use when they appear. - Rolandius
  • These are the most common error messages for form validation. yiiframework.com/doc/api/1.1/CActiveForm#error-detail <? php echo $ form-> error ($ model, 'attribute'); ?> - Vitalik Z
  • show your form is used or not ajax what settings for it? show the code you put in jquery.yiiactiveform.js to some that will make it clear what you want to do. - Bookin
  • Did it really help? - Vitalik Z

1 answer 1

To do this, there are events such as beforeValidate, etc.

 <?php $js = <<<JAVASCRIPT jQuery('#myform').on("beforeValidate", function(event, messages, deferreds) { // тут делай что хочешь }); JAVASCRIPT; $this->registerJs($js);