ok, so i wrote a new application and did the minimum to strip away the other code and things i am doing to prove that this behaviour is quite odd. i wrote this under web2py 2.4.6.
here is the added code for a default *db.py*: #begin db = DAL('postgres://postgres:passwd@localhost/test', pool_size=29) db.define_table('test1', Field('master_id', 'integer', required=IS_NOT_EMPTY()), Field('input_date', 'datetime', writable=False, readable=False, requires=NE, default=datetime.datetime.today()), Field('s1', length=16), Field('i1', 'integer'), Field('s2', length=16), Field('i2', 'integer'), format = '%(id)s, %(master_id)s') #end where the table is emulating a detail table of a master and must store the master_id reference. here is the code added to a default *default.py* file: #begin def test1a(): try: tidi = mcp.request_to_int(request.args[0]) #test id except: tidi = None tTest = db.test1 #sTest = db(tTest.id==tidi).select().first() now = datetime.datetime.utcnow() sform = SQLFORM(tTest, record=tidi, fields=['id', 'master_id', 's1', 'i1']) sform.vars.master_id = 1 sform.vars.input_date = sform.vars.input_date #return HTML(BODY("tidi: %s" % tidi, BR(), "now: %s" % now, BR(), "%s" % sform)) if sform.process(onvalidation=chk_test1a).accepted: response.flash = "TEST1a Updated" elif sform.errors: response.flash = "TEST1a Errors" slist = db(tTest.id>0).select(orderby=tTest.id) for i in slist: i.input_date = A(i.input_date, _href=URL(f="test1a", args=[i.id])) return dict(slist=slist, sform=sform) def chk_test1a(f): v = f.vars v.s1 = v.s1[:16] return f def test1b(): try: tidi = mcp.request_to_int(request.args[0]) #test id except: tidi = None tTest = db.test1 #sTest = db(tTest.id==tidi).select().first() now = datetime.datetime.utcnow() sform = SQLFORM(tTest, record=tidi, fields=['id', 'master_id', 's2', 'i2']) sform.vars.master_id = 1 #return HTML(BODY("tidi: %s" % tidi, BR(), "now: %s" % now, BR(), "%s" % sform)) if sform.process(onvalidation=chk_test1b).accepted: response.flash = "TEST1b Updated" elif sform.errors: response.flash = "TEST1b Errors" slist = db(tTest.id>0).select(orderby=tTest.id) for i in slist: i.input_date = A(i.input_date, _href=URL(f="test1b", args=[i.id])) return dict(slist=slist, sform=sform) def chk_test1b(f): v = f.vars v.s2 = v.s2[:16] return f #end and here is the code for the *test1a.html* view file: #begin {{left_sidebar_enabled=right_sidebar_enabled=False}} {{extend 'layout.html'}} <p>{{=A("Goto test1b", _href=URL(f="test1b"))}}</p> <p>{{=slist}}</p> <p>{{=A("Add New Record", _href=URL(f="test1a"))}}</p> {{=sform.custom.begin}} <table> <tr><td colspan="2">{{=sform.custom.widget.id}}</td></tr> <tr><td style="text-align:right;">S1:</td><td>{{=sform.custom.widget.s1}}</td></tr> <tr><td style="text-align:right;">I1:</td><td>{{=sform.custom.widget.i1}}</td></tr> <tr><td colspan="2">{{=sform.custom.submit}}</td></tr> </table> {{if sform.errors: =sform.errors pass}} {{=sform.custom.end}} <p>{{=sform}}</p> #end and similarly here is the code for the *test1b.html* view file: #begin {{left_sidebar_enabled=right_sidebar_enabled=False}} {{response.subsubtitle = "TEST1b"}} {{extend 'layout.html'}} <p>{{=A("Goto test1a", _href=URL(f="test1a"))}}</p> <p>{{=slist}}</p> <p>{{=A("Add New Record", _href=URL(f="test1b"))}}</p> {{=sform.custom.begin}} <table> <tr><td colspan="2">{{=sform.custom.widget.id}}</td></tr> <tr><td style="text-align:right;">S2:</td><td>{{=sform.custom.widget.s2}}</td></tr> <tr><td style="text-align:right;">I2:</td><td>{{=sform.custom.widget.i2}}</td></tr> <tr><td colspan="2">{{=sform.custom.submit}}</td></tr> </table> {{if sform.errors: =sform.errors pass}} {{=sform.custom.end}} #end which is just the opposite of test1a. try it without the fields option under SQLFORM. you will see the wiping or nulling of the other fields' data. with the fields options, the master_id and input_date don't work right because then those fields are wiped or nulled. i need all of the data to stick and stay no matter which view is running. thanx in advance and hopefully this proves the point. lucas -- 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/groups/opt_out.