Are you saying you have multiple forms on the same page? The allowance of multiple formkeys for the same form was not really intended for the case of multiple forms on the same page -- rather, it was intended more for the case where the user might open up the same page in multiple browser tabs and end up submitting the form on some tab other than the last one loaded. When you have multiple distinct forms (even if they happen to contain the same set of fields), the proper approach is to use different formnames for each form (formkeys are unique to each formname, so you can have as many as you want).
Anthony On Thursday, April 28, 2016 at 11:23:14 AM UTC-4, Robert Pates wrote: > > I have inherited a very nice clinical trials randomization module written > in web2py (2.9.5) and have been asked to modify it to accommodate a new > clinical study. > The application features a screen to display all the randomization strata > in a list on the screen -- each stratum generates a form using > SQLFORM.factory and these are written to a python dictionary and processed > in a loop: > > if form.process(formname='form1').accepted: > > Up to this point the clinical studies have had few strata (< 10). This > latest study, however, has N=16 strata. Everything looked fine until I > checked the functioning of all the 16 forms and found that some worked > (i.e. were accepted) and some didn't. Then, after debugging into html.py > (accepts function) I noticed that there were only 10 formkeys represented > in the session at any one time. Then, after much ado I found this post: > > http://comments.gmane.org/gmane.comp.python.web2py/129006 > in which Anthony explains that, indeed the formkey list in the session > holds 10 rotating entries. > > I'm wondering what my best options are to address this issue -- I'm > somewhat at a loss. Another post I found indicated that the following > snippet from html.py accepts function generates the formkey list in the > session: > > session[keyname] = list(session.get(keyname,[]))[-9:] + [formkey] > > So just for fun I altered the "-9" to "-15" and now everything appears to > work fine. > > I have trouble believing that tampering with web2py code is a reasonable > approach -- is this change likely to break web2py? Why is the limit set at > 10 entries by default? By now you have probably gathered I am new to > web2py. Any comments would be welcome. > > Thanks -- > -- 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.

