Have a nice day. How I can change url in bootstrap modal? I making confirmation dialog with yii bootstrap extension. I have list of buttons with different on action url.
Buttons code
foreach ($Users as $a)
{
$this->widget('bootstrap.widgets.TbButton', array(
'label'=>Yii::t('default-ui', 'Remove'),
'type'=>'action',
'icon'=>'trash',
'size'=>'mini',
'htmlOptions'=>array(
'data-toggle'=>'modal',
'data-target'=>'#myModal',
)));
};
Modal form code:
<?php $this->beginWidget('bootstrap.widgets.TbModal', array('id'=>'myModal')); ?>
<div class="modal-header">
<a class="close" data-dismiss="modal">×</a>
<h4>Removing user</h4>
</div>
<div class="modal-body">
<p>You really want remove this user?</p>
</div>
<div class="modal-footer">
<?php
$this->widget('bootstrap.widgets.TbButton', array(
'type'=>'inverse',
'label'=>'Cancel',
'url'=>'#',
'htmlOptions'=>array('data-dismiss'=>'modal'),
));
$this->widget('bootstrap.widgets.TbButton', array(
'type'=>'danger',
'label'=>'Yes, remove',
//'url'=>Yii::app()->createUrl('users/remove', array('id'=>$a['id'])), // here should be dynamic link for removing profile
));
?>
</div>
<?php $this->endWidget(); ?>
Try this
$('#view_more')
.removeData('modal')
.modal({
remote: someURL, //your url
show: false
});
A small demo FIDDLE DEMO
try this
<?php $this->widget('bootstrap.widgets.TbButton', array(
'buttonType'=>'link',
'url'=> array("/users/remove/{$a['id']}"),
'type'=>'danger',
'label'=>'Yes, remove',
)); ?>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.