my exact code : def on_define_default_size(table): # compute #table.total_square_meter.compute = lambda r: (float(r['length_in_cm'] ) * float(r['width_in_cm'] ) ) / 10000 # label table.name.label = T('Name') table.length_in_cm.label = T('Length in Cm') table.width_in_cm.label = T('Width in Cm') table.total_square_meter.label = T('Total Square Meter') table.acquisition_price.label = T('Acquisition Price') table.selling_price.label = T('Selling Price') # notnull table.name.notnull = True table.length_in_cm.notnull = True table.width_in_cm.notnull = True #table.total_square_meter.notnull = True table.acquisition_price.notnull = True table.selling_price.notnull = True # readable table.total_square_meter.readable = not new_or_edit_grid # represent table.length_in_cm.represent = lambda value, field: locale.format("%.1f", value, grouping = True) table.width_in_cm.represent = lambda value, field: locale.format("%.1f", value, grouping = True) table.total_square_meter.represent = lambda value, field: locale.format("%.3f", value, grouping = True) table.acquisition_price.represent = lambda value, field: format(value, ",d").replace(",", ".") table.selling_price.represent = lambda value, field: format(value, ",d").replace(",", ".") # required table.name.required = True table.length_in_cm.required = True table.width_in_cm.required = True #table.total_square_meter.required = True table.acquisition_price.required = True table.selling_price.required = True # requires table.name.requires = IS_NOT_EMPTY() table.length_in_cm.requires = IS_NOT_EMPTY() table.width_in_cm.requires = IS_NOT_EMPTY() #table.total_square_meter.requires = IS_NOT_EMPTY() table.acquisition_price.requires = IS_NOT_EMPTY() table.selling_price.requires = IS_NOT_EMPTY() # writable table.total_square_meter.writable = not new_or_edit_grid
db.define_table('default_size', Field('name'), Field('length_in_cm', 'double'), Field('width_in_cm', 'double'), Field('total_square_meter', 'double'), Field('acquisition_price', 'integer'), Field('selling_price', 'integer'), auth.signature, on_define = on_define_default_size, format = lambda r: '%s x %s x %s' % (r.name, r.length_in_cm, r.width_in_cm) ) yes, you all right, thank you so much, my bad, i understand now, it's better to disable notnull, required and requires for the compute field or either disable the compute in the backend database and use compute in controller instead for the mandatory compute field. at first i think the factor of the calculation field (length_in_cm and width_in_com already filled in the table, so just update the acquisition field and do the compute formula base on the filled value in the table). thanks and best regards, stifan -- 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.