I have this in model.
db.define_table('amc_master',
Field('amcno',
type='string',length=10,required='True',notnull='True',requires=IS_LENGTH(10)),
Field('unitid',type='string',length=3,notnull='True'),
Field('amcdesc',
type='string',length=512,required='True',notnull='True'),
Field('estval', type='decimal(18,2)'),
Field('supcflg', type='string', length=1),
Field('supcval',type='decimal(18,2)'),
Field('netestval',type='decimal(18,2)'),
Field('bidmethod',type='string',length=3),
Field('capbud',type='string',length=1),
Field('amcmod',type='string',length=3),
Field('lrrflg',type='string',length=1),
Field('insflg',type='string',length=1),
Field('stflg',type='string',length=1),
Field('phwflg',type='string',length=1),
Field('contyp',type='string',length=3),
Field('rfact',type='decimal(18,2)'),
Field('qfact',type='decimal(18,2)'),
Field('emdamt',type='decimal(18,2)'),
Field('doccharge',type='decimal(18,2)'),
Field('divn',type='string',length=3),
Field('subdivn',type='string',length=2),
Field('cflg',type='string',length=1),
Field('statflg',type='string',length=3),
Field('appauthority',type='string',length=16),
Field('accappddt',type='datetime'),
Field('iewappddt',type='datetime'),
Field('complndays',type='integer'),
Field('examcno',type='string',length=10),
Field('consoldamcstr',type='string',length=70),
Field('isconsold',type='string',length=1),
Field('estonprovn',type='decimal(18,2)'),
Field('totest',type='decimal(18,2)'),
Field('update_uid','string',length=6,required='True',notnull='True'),
Field('update_dt','datetime',required='True',notnull='True')
)
in controller i have this
def newamcmaster():
list_of_fields =
[db.amc_master.amcdesc,db.amc_master.amcmod,db.amc_master.complndays]
[setattr(f, 'readable', False) for f in db.amc_master if f.name not in
['amcdesc','amcmod','complndays']]
[setattr(f, 'writable', False) for f in db.amc_master if f.name not in
['amcdesc','amcmod','complndays']]
grid =
SQLFORM.grid(db.amc_master,user_signature=False,fields=list_of_fields,oncreate=create_new_amc)
return locals()
when I call http://127.0.0.1:8000/web_ocms/amc/newamcmaster the grid
displays the three fields amcdesc, amcmod, complndays.
When addrecord is clicked it displays form with the above three fields
correctly.
Now the amcno,update_uid, update_dt fields are mandatory but has to be
filled by the server. The user is not to input these fields.
How to insert a new record with user inputting the three fields and other
required fields are filled in oncreate callback or some other methods. Pl.
help. Regards.
--
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 [email protected].
For more options, visit https://groups.google.com/d/optout.