Quantcast
Channel: Yii Framework Forum
Viewing all articles
Browse latest Browse all 18717

Ajaxbutton In Two Sub Page, The Second Does Not Work

$
0
0
hi all:

I have a page named '_form.php' . In this page , i used a modal dialog(bootstrap extension).in the modal dialog.

I used bootstrap tab control extension in my page. Such as :
<?php  $this->widget('bootstrap.widgets.TbTabs', 
	array('type'=>'tabs', // 'tabs' or 'pills'
		'tabs'=>array(
			array('label'=>'Project','content'=>$this->renderPartial('_form',array('model'=>$model),true,true),'active'=>true ),
			array('label'=>'Member','content'=>$this->renderPartial('_check_user',array('model'=>$model),true,true),'visible'=>$model->isNewRecord ? 'false' : 'true')
			)
	));
?>

in sub page '_form', i hava a modal dialog named '_select_user' and an ajaxButton in it , i call it A_Button such as :
in '_form' :
<?php echo $this->renderPartial('_select_user'); ?>

in '_select_user':
<?php echo CHtml::ajaxButton('search', array('getUser'),
	array(//'success'=>'js:function(data){alert(data);}',
		'data'=>array('name'=>'js:$("#User_name").val()',
		'department_id'=>'js:$("#User_department_id option:selected").val()',
		'parent_form'=>'$("#modalType").val()'),
		'type'=>'POST',
		'update'=>'#user_list','return'=>true)
	,array('class'=>'btn btn-success btn-small'))?>


in sub page '_check_user', also have an ajaxButton in it,i call it B_Button,such as :
<?php echo CHtml::ajaxButton('search', array('getCheckUser'),
	array(//'success'=>'js:function(data){alert(123);}',
		'data'=>array('name'=>'js:$("#User_name_1").val()',
		'department_id'=>'js:$("#User_department_id_1 option:selected").val()'),
		'type'=>'POST',
		'update'=>'#user_list_from',
		'return'=>false)
	,array('class'=>'btn btn-success btn-small'))?>


Now, my problom is : click B_Button, there is nothing happened.
In page source . generated javascript is :
$('body').on('click','#yt1',function(){jQuery.ajax({'data':{'name':$("#User_name").val(),'department_id':$("#User_department_id option:selected").val(),'parent_form':'$(\"#modalType\").val()'},'type':'POST','return':true,'url':'/projectq/index.php?r=project/getUser','cache':false,'success':function(html){jQuery("#user_list").html(html)}});return false;});
jQuery('#modalManager').modal({'show':false});

$('body').on('click','#yt2',function(){jQuery.ajax({'data':{'name':$("#User_name_1").val(),'department_id':$("#User_department_id_1 option:selected").val()},'type':'POST','return':false,'url':'/projectq/index.php?r=project/getCheckUser','cache':false,'success':function(html){jQuery("#user_list_from").html(html)}});return false;});
jQuery('#yw0').tab('show');


if i comment A_Button , B_Button workes fine .
Or if i change B_Button' render before A_Button . B work fine , A does not work.

any ideas?

My native language is not english , I try my best to wrote this.

thanks all.

Viewing all articles
Browse latest Browse all 18717

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>