I'm newbie in Yii framework and start learning on small web project so I got stuck on this position as how to solve it.
I have a 'Order_form' where a user has confirm his order and if want to change the 'Qty' so only this can change then bydoing this I need to change the Total value to be calculate on fly on same form if Qty got changed by user.
beginWidget('CActiveForm', array( 'id'=>'order-form', 'enableAjaxValidation'=>false, )); ?><div class="row">
<?php echo $form->labelEx($model,'price'); ?>
<?php echo $model->price; ?>
</div>
<div class="row">
<?php echo $form->labelEx($model,'qty'); ?>
<?php echo $form->textField($model,'qty'); ?>
<?php echo $form->error($model,'qty'); ?>
</div>
<div class="row">
<?php echo $form->labelEx($model,'total'); ?>
<?php echo $form->textField($model,'total'); ?>
</div>
endWidget(); ?>
$(document).ready(function() { var myVar = '999'; $("#model_total").val(myVar); }); '
Here I updated my script to clarify what I need, so here I'm trying to pass a value of '999' to 'Total' on the same form but this doesn't work. It might be that I'm missing/doing something wrong.
I would also like other way to calculate Qty x Price and get the result from the controller if this is possible if so please guide through code.