try add <input name="id" value="{{=form.record.id}}" type="hidden" />
On Dec 28, 9:22 am, Peter <peter.kleyn...@gmail.com> wrote: > Massimo, I'm trying to use this technique, as follows: > > Controller: > def inschrijving(): > vrouw=db(db.t2_person.id==t2.person_id).select()[0] > form=SQLFORM(db.t2_person,vrouw) > if form.accepts(request.vars,session): > response.flash='OK.' > return dict(form=form) > > View (inschrijving.html): > {{extend 'layout.html'}} > <form> > <label>{{=db.t2_person.name.label}}</label> > <input name="name" value="{{=form.latest.name}}" /> > <label>{{=db.t2_person.landcode.label}}</label> > <input name="landcode" value="{{=form.latest.landcode}}" /> > {{if form.errors.landcode:}}{{=form.errors.landcode}}{{pass}} > <input type="submit" value="Save"/> > {{=form.hidden_fields()}} > </form> > > I can't get much closer to the snippet that you posted than this? ;-) > > Problem: nothing happens if I click submit (no flash message, no > update in db). > Among much else, I've tried: > - adding "action" and "method' attributes to form; > - form.accept with "formname=None" instead of session; > - form.accept without any second argument > -- no luck with any of them. > > What am I doing wrong?? > > Cheers, > -Peter > > On Nov 10, 9:15 pm, mdipierro <mdipie...@cs.depaul.edu> wrote: > > > You can havecustomforms. You always could. Since version 1.48 > > (posted today) it is even easier: > > > #in model: > > > db.define_table('mytable',SQLField('myfield')) > > > #in controller: > > > def index(): > > form=SQLFORM(db.mytable) > > if form.accepts(request.vars,session): > > response.flash='form accepted' > > return dict(form=form) > > > #and in view: > > > {{extend 'layout.html'}} > > > <form> > > <label>{{=db.mytable.myfield.label}}</label> > > <input name="myfield" value="{{=form.latest.myfield}}" /> > > {{if form.errors.myfield:}}{{=form.errors.myfield}}{{pass}} > > <input type="submit" /> > > {{=form.hidden_fields()}} > > </form> > > > Massimo > > > On Nov 10, 2:04 pm, "Daniel Guryca" <dun...@gmail.com> wrote: > > > > Hey totally agree with you ! > > > > It is too bad not to be able to define my own fully customizedforms > > > within a view, > > > operate over them in a controller but still need to have a necessary > > > relation to a database model ! > > > > Logic should be defined in a controller and presentation in a view. > > > > Daniel > > > > On Mon, Nov 10, 2008 at 2:23 PM, billf <billferr...@blueyonder.co.uk> > > > wrote: > > > > > Hi All > > > > > I know that there is a patch related tocustomviews in the pipeline > > > > but this proposal is another step on from that. > > > > > I am proposing an additional approach that enables those things that > > > > (I consider) are view-related to be moved from the model and > > > > controller to the view. In addition, it provides separation of html > > > > form from model related logic such as validation and db updating. > > > > > There are still some areas to be covered but I have written a page > > > > that, hopefully, explains the ideas at > > > > >http://www.wellbehavedsystems.co.uk/web2py/examples/mvc.html > > > > > All comments gratefully accepted. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---