thispage.update_record(form.vars.wikibody1) should be
thispage.update_record(wikibody1=form.vars.wikibody1) On Feb 25, 4:39 pm, murray3 <ch...@murraypost.net> wrote: > almost got the gist of how this works, I am struggling with db update > syntax. > > thispage.update_record(form.vars.wikibody1) is not working? > > in controller: > > def edit(): > try: thispage=db(db.page.id==request.args[0]).select()[0] > except: redirect(URL(r=request,f='index')) > form=FORM(DIV(TEXTAREA(_style="width: 98%;", > _name="wikibody1", > _id="wikibody1",)),INPUT(_type="submit",_value="Save")) > if form.accepts(request.vars,session): > thispage.update_record(form.vars.wikibody1) > response.flash="form accepted!" > else: > response.flash="form is invalid!" > return dict(form=form,page=thispage) > > returns error: > Error traceback > > Traceback (most recent call last): > File "C:\APPS\web2py\gluon\restricted.py", line 98, in restricted > exec ccode in environment > File "C:/APPS/web2py/applications/fabmonger/controllers/default.py", > line 126, in <module> > File "C:\APPS\web2py\gluon\globals.py", line 75, in <lambda> > self._caller = lambda f: f() > File "C:/APPS/web2py/applications/fabmonger/controllers/default.py", > line 56, in edit > thispage.update_record(form.vars.wikibody1) > File "C:\APPS\web2py\gluon\sql.py", line 2058, in <lambda> > s=self._db(table.id == id), **a: update_record(t,s, a) > File "C:\APPS\web2py\gluon\sql.py", line 1962, in update_record > s.update(**a) > File "C:\APPS\web2py\gluon\sql.py", line 1927, in update > self._db._execute(query) > File "C:\APPS\web2py\gluon\sql.py", line 569, in <lambda> > **b) > OperationalError: near "WHERE": syntax error > > any help appreciated. > Chris > > On Feb 24, 2:27 am, Yarko Tymciurak <yark...@gmail.com> wrote: > > > If you make a view for your form this will help you control it. > > If you use FORM(...) instead of SQLFORM() this will not generate tables. > > > Seehttp://mdp.cti.depaul.edu/examples/static/cookbook.pdf > > > Then you will need to name the fields in your form, and update the data > > record - since you have one field, this is not too bad. > > > On Mon, Feb 23, 2009 at 5:36 PM, murray3 <ch...@murraypost.net> wrote: > > > > thanks Yarko for that, it works, I was approaching this from the view, > > > not the controller. > > > one more thing I am stuck with, how do I modify the SQLFORM formatting > > > to only have > > > a textarea - i.e. no table, no labels, just textarea and submit? > > > chris > > > > On Feb 23, 5:03 am, Yarko Tymciurak <yark...@gmail.com> wrote: > > > > ugh...never write email before dinner: > > > > > On Sun, Feb 22, 2009 at 8:54 PM, Yarko Tymciurak <yark...@gmail.com> > > > wrote: > > > > > > Something like this works - but you may not want to define your own > > > > > you may _want_ to define your own template.... > > > > > > template: > > > > > > in models/db.py: > > > > > db.define_table('comment', > > > > > SQLField( 'comment','text', length=256 )) > > > > > > then in controllers/default.py: > > > > > > def myform(): > > > > > form=SQLFORM(db.comment, _style='width:100%') # this gets > > > > > inserted in the <form.... > > > > > if form.accepts(request.vars, session): > > > > > response.flash='form accepted' > > > > > elif form.errors: > > > > > response.flash='form has errors' > > > > > return dict(form=form) > > > > > > Regards, > > > > > Yarko > > > > > > On Feb 22, 5:50 pm, murray3 <ch...@murraypost.net> wrote: > > > > > > I have been enjoying the flexibiity of web2py, and my app idea is > > > > > > progressing > > > > > > well, it is something I have been contemplating for a long time and > > > > > > I > > > > > > will release it > > > > > > when I get it to a suitable stage as to take it further it needs to > > > be > > > > > > open source. > > > > > > > So with that in mind, I would like to solve my most irritating issue > > > > > > with which I am obviously > > > > > > missing something even trying the code offered up in these > > > > > > discussions! > > > > > > > I want a sqlform with just a textarea and submit button but I want > > > the > > > > > > textarea to be > > > > > > style="width: 100%;" easy, but unfortunatley my attempts are not > > > > > > updating the db. > > > > > > > Any help most appreciated . > > > > > > chrism --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---