0
下午好,我一直在努力與這些2天,現在,我的時間不多了......誼:從OnClick方法
我有這個模式......將值分配給一個變量
<div class="modal-header">
<a class="close" data-dismiss="modal">×</a>
<?php if ($modalToOpen == "1") { ?>
<h4>Aplicar abono a la cuenta #<?php echo $cardInformation->CardNumber ?></h4>
<?php } ?>
<?php if ($modalToOpen == "2") { ?>
<h4>Aplicar cargo a la cuenta #<?php echo $cardInformation->CardNumber ?></h4>
<?php } ?>
</div>
<div class="modal-body">
<p>Saldo Actual: <?php echo $lastBalance ?></p>
<?php echo $modalToOpen ; if($modalToOpen == 1){ ?>
<?php $form = $this->beginWidget('bootstrap.widgets.TbActiveForm', array('id' => 'inlineForm', 'type' => 'inline', 'htmlOptions' => array('class' => 'well'))); ?>
<?php echo $form->TextField($auxModel, 'Payment', array('size' => 8, 'maxlength' => 8, 'placeholder' => "$. Abono", 'class' => 'span1')); ?>
<?php echo $form->TextField($auxModel, 'Coment', array('size' => 250, 'maxlength' => 250, 'placeholder' => "Comentario", 'class' => 'span3')); ?>
<?php
$this->widget(
'bootstrap.widgets.TbButton', array(
'buttonType' => 'ajaxButton',
'type' => 'primary',
'label' => 'Guardar',
'url' => Yii::app()->createUrl('BusinessTargetCollectionCard/ApplyPayment'),
'htmlOptions' => array('onclick' => 'showWait();','id' =>'payment-btn'. uniqid()),
'ajaxOptions' => array(
'type' => 'POST',
'dataType' => 'json',
'data' => array(
'cardNumber' => $cardInformation->CardNumber,
'lastBalance' => $lastBalance,
'coment' => 'js:$("#BusinessTargetCollectionCardMovement_Coment").val()',
'payment' => 'js:$("#BusinessTargetCollectionCardMovement_Payment").val()',
'businessTargetCollectionCardId' => $cardInformation->Id,
'collectorId' => $cardInformation->CollectorId),
'success' => 'js:function(data){
alert(data.message);
if(data.status == "OK"){
$("#PaymentModal").modal("hide");
hideWait();
}
}'
),
)
);
$this->endWidget(); ?>
<?php } ?>
<?php if($modalToOpen == 2){ ?>
<?php $form = $this->beginWidget('bootstrap.widgets.TbActiveForm', array('id' => 'inlineForm', 'type' => 'inline', 'htmlOptions' => array('class' => 'well'))); ?>
<?php echo $form->TextField($auxModel, 'BalanceAfter', array('size' => 8, 'maxlength' => 8, 'placeholder' => "Cantidad a aplicar", 'class' => 'span1')); ?>
<?php
$this->widget(
'bootstrap.widgets.TbButton', array(
'buttonType' => 'ajaxButton',
'type' => 'primary',
'label' => 'Guardar',
'url' => Yii::app()->createUrl('BusinessTargetCollectionCard/ApplyCharge'),
'htmlOptions' => array('onclick' => 'showWait();', 'id' => 'charge-btn' . uniqid()),
'ajaxOptions' => array(
'type' => 'POST',
'dataType' => 'json',
'data' => array(
'cardNumber' => $cardInformation->CardNumber,
'charge' => 'js:$("#BusinessTargetCollectionCardMovement_BalanceAfter").val()'),
'success' => 'js:function(data){
alert(data.message);
if(data.status == "OK"){
$("#myModal").modal("hide");
hideWait();
}
}'
),
)
);
$this->endWidget();
?>
<?php } ?>
</div>
,我有以下按鈕:
<td><?php
$this->widget(
'bootstrap.widgets.TbButton', array(
'label' => 'Aplicar cargo',
'type' => 'success',
'htmlOptions' => array(
'onclick' => I dont know what to do // 'js:$("#modalToOpen").val("1");',
'data-toggle' => 'modal',
'data-target' => '#myModal',
),
)
);
?></td>
<td></td>
<td><?php
$this->widget(
'bootstrap.widgets.TbButton', array(
'label' => 'Aplicar pago',
'type' => 'primary',
'htmlOptions' => array(
'onclick' => I dont know what to do //'js:$("#modalToOpen").val("2");',
'data-toggle' => 'modal',
'data-target' => '#myModal',
),
)
);
?></td>
我想要做的是改變取決於的$modalToOpen
值在其上點擊按鈕...這樣的模式的內容會有所不同,如果按鈕1是點擊或按鈕2 ...
請任何幫助將真正appreacciated