Correction, you should not set vars using field names already in the
form, otherwise they will be duplicated.

def show():
        rid=request.vars.rid
        record=db(db.addresses.id==rid).select()

def input():
        form = SQLFORM(db.addresses)
        if form.accepts(request.vars, session):
                redirect(URL(r=request,
f='show',vars={'rid':form.vars.id}))
        return dict(form=form)



On Dec 13, 10:48 pm, DenesL <denes1...@yahoo.ca> wrote:
> Hi Rick,
>
> On Dec 13, 6:55 pm, Rick <sababa.sab...@gmail.com> wrote:
>
> > Hi,
>
> > I'm trying to make a data base for storing names and addresses, but
> > since I'm a n00b then I can't get it working. I've no idea what's
> > wrong. The problem is that the input function doesn't redirect to the
> > show function and that the show function doesn't show any data. Here's
> > the code:
>
> > the controller file:
> > def show():
> >         id=request.vars.id
> >         record=db(db.measure.id==id).select()
>
> record=db(db.addresses.id==id).select()
>
> >         return dict(record=record)
>
> > def input():
> >         form = SQLFORM(db.addresses)
> >         if form.accepts(request.vars, session):
> >                 redirect(URL(r=request, f='show'))
>
> redirect(URL(r=request, f='show',vars={'id':form.vars.id}))
>
> >         return dict(form=form)
>
> > **********************
>
> > and the model file table:
>
> > db.define_table('addresses',
> >      Field('person'),
> >      Field('adress'))
>
> Field('address'))
>
>
>
> > **********************
>
> > input.html
> > {{extend 'layout.html'}}
> > {{=form}}
>
> > **********************
>
> > show.html:
> > {{extend 'layout.html'}}
> > <h1>Addresses</h1>
> > {{for record in record:}}
> > {{=record.name}} : {{=record.address}}<br>
>
> {{=record.person}} : {{=record.address}}<br>
>
> > {{pass}}
>
> > **********************
>
> > Thanks in advance for help!
>
>

Reply via email to