0
我想在給定輸入時計算qty *價格,當價格和數量自動變化時應該使用codeigniter中的JavaScript事件更改總計應該禁用我的代碼爲遵循如何在codeigniter vew頁面中使用javascript來生成onkeyup事件
<script>
functionn caltotal()
{
}
</script>
<?php
echo form_open('add_veg/insert_data', 'class="form-horizontal" id="myform" role="form"');
$sales_date = array(
'type' => 'date',
'name' => 'date',
'id' => 'date',
'class' => 'form-control'
);
$vegnames=array();
foreach($veg_names as $r){
$vegnames[$r->value]=$r->label;
}
/*
$vegnames = array(
'cauliflower' => 'Caulifower',
'Brinjal' => 'Brinjal'
);
*/
$wt = array(
'type' => 'text',
'name' => 'weight',
'id' => 'wt',
'class' => 'form-control'
);
$price = array(
'type' => 'text',
'name' => 'price',
'id' => 'price',
'class' => 'form-control'
);
$total=array(
'type'=>'readonly',
'name'=>'total',
'id'=>'total',
'class'=>'form-control disabled'
);
$save=array(
'name' =>'sub',
'value' =>'Save',
'class' =>'btn btn-success btn-sm'
);
echo form_label('Sales date', 'sdate', 'class="control-label col-sm-2"');
echo form_input($sales_date);
echo form_label('Vegitable Name', 'vname', 'class="control-label col-sm-2"');
//echo form_input($veg_name);
echo form_dropdown('v_name', $vegnames,'','class="form-control"');
echo form_label('Weight', 'wt', 'class="control-label col-sm-2"');
echo form_input($wt);
echo form_label('Price', 'price', 'class="control-label col-sm-2"');
echo form_input($price);
echo form_label('Total', 'total', 'class="control-label col-sm-2"');
echo form_input($total);
echo form_submit($save);
echo form_close();
?>