Hello,
I am facing two problems with CJuiDialog:
1. if I set modal => true, then all text field (CActiveForm) in the dialog are become disabled.
2. I have two CJuiDialog (A and
in the view, both are with CActiveForm. I don't know why but jQuery code duplicates for the dialog B.
Dialog's A content renders by $this->render (as far as inherits from CWidget), second's - by $this->renderPartial in the view. I tried to play with true, false parameters - but jQuery includes more and more. Without true,false - always two the same jQuery blocks for the dialog B.
What could be a reason?
PHP 5.4.11, Yii 1.1.13, jQuery UI - 1.8.
Thank you.
P.S. the code:
Dialog В which duplicates javascript. View:
_updatePassword.php:
Result is:
And in the bottom of the page:
I am facing two problems with CJuiDialog:
1. if I set modal => true, then all text field (CActiveForm) in the dialog are become disabled.
2. I have two CJuiDialog (A and

Dialog's A content renders by $this->render (as far as inherits from CWidget), second's - by $this->renderPartial in the view. I tried to play with true, false parameters - but jQuery includes more and more. Without true,false - always two the same jQuery blocks for the dialog B.
What could be a reason?
PHP 5.4.11, Yii 1.1.13, jQuery UI - 1.8.
Thank you.
P.S. the code:
Dialog В which duplicates javascript. View:
<? echo CHtml::link( CHtml::encode( Yii::t('account','TEXT_CHANGE_PASSWORD') ), array( 'action', 'id'=>'#' ), array( 'onclick'=>'$("#updatePasswordDialog").dialog("open"); return false;' ) ); ?> <!-- Change password dialog --> <? $this->beginWidget('zii.widgets.jui.CJuiDialog',array( 'id'=>'updatePasswordDialog', // additional javascript options for the dialog plugin 'options'=>array( 'title' => Yii::t('account','TEXT_CHANGE_PASSWORD'), 'autoOpen' => false, 'modal' => false, 'resizable' => false, 'width' => 'auto', 'height' => 'auto', 'position' => 'center', 'dialogClass' => 'class' ), )); Yii::app()->clientScript->scriptMap['jquery-ui.min.js'] = false; Yii::app()->clientScript->scriptMap['jquery.min.js'] = false; echo $this->renderPartial('_updatePassword',array( 'model'=>$model )); $this->endWidget('zii.widgets.jui.CJuiDialog'); ?> <!-- end of update mileage dialog -->
_updatePassword.php:
<? $form = $this->beginWidget('CActiveForm', array( 'id'=>'update-password-form' . rand(), 'enableAjaxValidation'=> false, 'htmlOptions' => array('class'=>'uniForm'), )); ?> <fieldset> <div class="ui-dialog-buttonpane ui-helper-clearfix" id="errorSummary1"> <? echo $form->errorSummary( $model, NULL, NULL, array('class'=>'ctrlHolder error') ); ?> </div> <div class="ctrlHolder"> <? echo $form->labelEx( $model, 'currentPassword' ); echo $form->passwordField( $model, 'currentPassword', array('size'=>32, 'maxlength'=>32, 'value'=>'') ); ?> </div> <div class="ctrlHolder"> <? echo CHtml::label( Yii::t('account','TEXT_NEW_PASSWORD'), false ); echo $form->passwordField( $model, 'password', array('size'=>32, 'maxlength'=>32, 'value'=>'') ); ?> </div> <div class="buttonHolder"> <? $this->widget('zii.widgets.jui.CJuiButton', array( 'name'=>'submit_' . rand(), 'caption'=> Yii::t('app','TEXT_SAVE'), 'htmlOptions'=>array('style' => 'width: 130px; height:25px; font-size: 8pt;', 'ajax' => array('url' => Yii::app()->createUrl(Yii::app()->baseUrl . '/account/updatePassword'), 'type'=>'post', 'data'=> 'js:jQuery(this).parents("form").serialize()', 'dataType' => 'json', 'success'=>'function(r) { if( r != null && r.status == "success" ) { window.location.reload(); } else { $("#errorSummary1").empty(); $("#errorSummary1").append(r.data); return false; } }' ) ) ) ); ?> </div> </fieldset> <? $this->endWidget('CActiveForm'); ?>
Result is:
<!-- Change password dialog --> <div id="updatePasswordDialog"> <form class="uniForm" id="update-password-form1729518609" action="/ru/account/viewProfile" method="post"> <div style="display:none"><input type="hidden" value="fc61228d4463429579e57c4f066ac8db38bd278d" name="YII_CSRF_TOKEN" /></div><input name="Account[name]" id="Account_name" type="hidden" value="XXX" /><input name="Account[currency]" id="Account_currency" type="hidden" value="-1" /><input name="Account[email]" id="Account_email" type="hidden" value="XXX" /><fieldset> <div class="ui-dialog-buttonpane ui-helper-clearfix" id="errorSummary1"> </div> <div class="ctrlHolder"> <label for="Account_currentPassword">TEXT_CURRENT_PASSWORD</label><input size="32" maxlength="32" value="" name="Account[currentPassword]" id="Account_currentPassword" type="password" /></div> <div class="ctrlHolder"> <label>TEXT_NEW_PASSWORD</label><input size="32" maxlength="32" value="" name="Account[password]" id="Account_password" type="password" /></div> <div class="buttonHolder"> <input style="width: 130px; height:25px; font-size: 8pt;" id="submit_896181584" name="submit_896181584" type="submit" value="Сохранить" /> </div> </fieldset> </form></div><!-- end of update mileage dialog --> <script type="text/javascript"> /*<![CDATA[*/ jQuery('#btnEditAccount').button([]); jQuery('#btnEditParams').button([]); jQuery('#updatePasswordDialog').dialog({'title':'TEXT_CHANGE_PASSWORD','autoOpen':false,'modal':true,'resizable':false,'width':'auto','height':'auto','position':'center'}); jQuery('body').on('click','#submit_896181584',function(){jQuery.ajax({'url':'/ru/account/updatePassword','type':'post','data':jQuery(this).parents("form").serialize(),'dataType':'json','success':function(r) { if( r != null && r.status == "success" ) { window.location.reload(); } else { $("#errorSummary1").empty(); $("#errorSummary1").append(r.data); return false; } },'cache':false});return false;}); jQuery('#submit_896181584').button([]); /*]]>*/ </script>
And in the bottom of the page:
<script type="text/javascript"> /*<![CDATA[*/ jQuery(function($) { jQuery('#btnEditAccount').button([]); jQuery('#btnEditParams').button([]); jQuery('#updatePasswordDialog').dialog({'title':'TEXT_CHANGE_PASSWORD','autoOpen':false,'modal':true,'resizable':false,'width':'auto','height':'auto','position':'center'}); jQuery('body').on('click','#submit_896181584',function(){jQuery.ajax({'url':'/ru/account/updatePassword','type':'post','data':jQuery(this).parents("form").serialize(),'dataType':'json','success':function(r) { if( r != null && r.status == "success" ) { window.location.reload(); } else { $("#errorSummary1").empty(); $("#errorSummary1").append(r.data); return false; } },'cache':false});return false;}); jQuery('#submit_896181584').button([]); /*]]>*/ </script>