Sorry. I am able to do it. In view new_contract.html I have now this. {{extend 'layout.html'}} <h1>New Contract</h1> {{=form}} <script language="JavaScript"> <!-- function calculate_rate(){ var stot1 = 0; lvhsk = parseFloat(document.getElementById('amc_details_hsk').value); lvsk = parseFloat(document.getElementById('amc_details_sk').value); lvssk = parseFloat(document.getElementById('amc_details_ssk').value); lvusk = parseFloat(document.getElementById('amc_details_usk').value); lvsft = parseFloat(document.getElementById('amc_details_shift').value); lvmisc = parseFloat(document.getElementById('amc_details_misc').value); lveqty = parseFloat(document.getElementById('amc_details_eqty').value); lvunt = parseFloat(document.getElementById('amc_details_unit').value); hv_hsk = 520.0; hv_sk = 500.0; hv_ssk = 480.0; hv_usk = 460.0; stot1 = ((((lvhsk*hv_hsk+lvsk*hv_sk+lvssk*hv_ssk+lvusk*hv_usk)*lvsft)+lvmisc)/lveqty)*lvunt; document.getElementById('amc_details_rate').value = stot1 ; } function calcamt(){ var rate = 0; rate = parseFloat(est_inputfrm.rate.value); qf = parseFloat(est_inputfrm.qfact.value); rf = parseFloat(est_inputfrm.rfact.value); rqnty = (qf/100)*parseFloat(est_inputfrm.qty.value); est_inputfrm.rvqty.value = rqnty; rrate = (rf/100)*parseFloat(rate); est_inputfrm.rrate.value = rrate; est_inputfrm.amt.value = rqnty*rrate; }
// --> </script> <script> jQuery(document).ready(function(){ $("#amc_details_hsk").change(function(){ calculate_rate(); }); $("#amc_details_sk").change(function(){ calculate_rate(); }); $("#amc_details_ssk").change(function(){ calculate_rate(); }); $("#amc_details_usk").change(function(){ calculate_rate(); }); $("#amc_details_shift").change(function(){ calculate_rate(); }); $("#amc_details_misc").change(function(){ calculate_rate(); }); $("#amc_details_eqty").change(function(){ calculate_rate(); }); $("#amc_details_unit").change(function(){ calculate_rate(); }); }); </script> Now I am able to set the rate for the job. Thanks for forbearing with me. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.