In model I have this db.define_table('amc_details', Field('amc_id','reference amc_master'), Field('jcod', type='string',required='True',notnull='True',length=10), Field('jobdesc',type='string',required='True',notnull='True',length=250), Field('rqty',type='decimal(18,2)',required='True',notnull='True'), Field('rrate',type='decimal(18,2)',required='True',notnull='True'), Field('qty',type='decimal(18,2)',required='True',notnull='True'), Field('rate',type='decimal(18,2)',required='True',notnull='True'), Field('amt',type='decimal(18,2)',required='True',notnull='True'), Field('hsk',type='decimal(18,5)',required='True',notnull='True'), Field('sk',type='decimal(18,5)',required='True',notnull='True'), Field('ssk',type='decimal(18,5)',required='True',notnull='True'), Field('usk',type='decimal(18,5)',required='True',notnull='True'), Field('shift',type='decimal(18,5)',required='True',notnull='True'), Field('eqty',type='decimal(18,2)',required='True',notnull='True'), Field('misc',type='decimal(18,2)',required='True',notnull='True'), Field('unit',type='decimal(18,2)',required='True',notnull='True'), Field('uom',type='string',required='True',notnull='True',length=16), Field('justn',type='text',required='True',notnull='True'), Field('scope',type='text',required='True',notnull='True'), Field('aflg',type='string',length=1,required='True',notnull='True'), Field('update_uid','string',length=6,required='True',notnull='True',default = session.uname), Field('update_dt','datetime',required='True',notnull='True',default=request.now) )
In controller this form = SQLFORM.smartgrid(db.amc_master, linked_tables=['amc_details'], user_signature=False, fields=dict(amc_master=list_of_fields), formstyle='table3cols', headers=headers ) Now when I click Add record of the child I get this. http://127.0.0.1:8000/web_ocms/amc/new_contract/amc_master/amc_details.amc_id/3/new/amc_details Here as the user inputs I would like to calculate the rate as (hsk+sk+ssk+usk)*shift/eqty This calculation I would like to do in javascript and populate the rate field of the above view. Where to write the javascript onchange functiion. I have only new_contract.html only. Pl.help. -- 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.