Sorry, It doesn't work.
categ_id = 0 if vars_list.has_key('categ') : categ_id = vars_list['categ'] form=SQLFORM(db.docs_book, fields=['author','title','volume','editor','collection', 'place','year','pages','number','keywords','language','isbn','comment'], labels={'author' : T('Author:'), 'title' : T('Title:')}, hidden=dict(docs_categ_id=categ_id), submit_button=T('Add')) In the html file <input name="docs_categ_id" type="hidden" value="3" / > is present. ionel On Feb 1, 2:07 pm, mdipierro <mdipie...@cs.depaul.edu> wrote: > sorry. you also need the new gluon/html.py > > On Feb 1, 12:43 pm, ionel <ionelanton...@gmail.com> wrote: > > > Ok, done. > > But after that: > > > Traceback (most recent call last): > > File "gluon/restricted.py", line 62, in restricted > > exec ccode in environment > > File "/home/web2py/site/web2py/applications/docs/controllers/ > > default.py", line 185, in <module> > > File "gluon/globals.py", line 55, in <lambda> > > self._caller=lambda f: f() > > File "/home/web2py/site/web2py/applications/docs/controllers/ > > default.py", line 172, in add_book > > if form.accepts(request.vars, session): > > File "gluon/sqlhtml.py", line 294, in accepts > > ret=FORM.accepts > > (self,vars,session,formname,keepvalues,onvalidation) > > TypeError: accepts() takes at most 5 arguments (6 given) > > > ionel > > > On Feb 1, 12:17 pm, mdipierro <mdipie...@cs.depaul.edu> wrote: > > > > can you get the gluon/sqlhtml.py and gluon/sql.py from trunk and see > > > if the problem goes away? > > > > Massimo > > > > On Jan 31, 10:12 pm, ionel <ionelanton...@gmail.com> wrote: > > > > > web2py Version 1.55.2 (2009-01-08 08:38:01) > > > > Apache/2.2.9 mod_python/3.3.1 Python/2.5.2 mod_wsgi/2.3 > > > > > On Jan 31, 10:54 pm, mdipierro <mdipie...@cs.depaul.edu> wrote: > > > > > > which version of web2py are you using? > > > > > > On Jan 31, 9:38 pm, ionel <ionelanton...@gmail.com> wrote: > > > > > > > Thank you Massimo. > > > > > > > I already applied your solution. > > > > > > I verified the request.vars.category_id content. It's "None". > > > > > > > ionel > > > > > > > On 31 Ian, 22:18, mdipierro <mdipie...@cs.depaul.edu> wrote: > > > > > > > > I am sure category_id is in request.vars.category_id > > > > > > > > accepts will not move it in form.vars.id it is not obvious that is > > > > > > > what you want to do. Try > > > > > > > > form=SQLFORM(db.book, > > > > > > > fields=['author','title'], > > > > > > > hidden=dict(category_id=the_category_id), > > > > > > > submit_button='Add') > > > > > > > form.vars.id=request.vars.category_id > > > > > > > > Massimo > > > > > > > > On Jan 31, 8:19 pm, ionel <ionelanton...@gmail.com> wrote: > > > > > > > > > I have the following example: > > > > > > > > > the_category_id = 1 > > > > > > > > > form=SQLFORM(db.book, > > > > > > > > fields=['author','title'], > > > > > > > > hidden=dict(category_id=the_category_id), > > > > > > > > submit_button='Add') > > > > > > > > > After submit, the field "category_id" has no content. > > > > > > > > I verified the source code of my page. The value is there: > > > > > > > > <input > > > > > > > > name="category_id" type="hidden" value="1" /> > > > > > > > > > I don't understand what is the problem. > > > > > > > > > Thank you > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "web2py Web Framework" group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~----------~----~----~----~------~----~------~--~---