there is nothing really crud specific:
def index():
form=SQLFORM(test.persons,request.args(0))
if form.accepts(request.vars): pass
persons=test(test.person.id>0).select(orderby=db.person.name)
return dict(form=form,persons=persons)
{{extend 'layout.html'}}
{{=form}}
{{for p in persons:}}
<a href="{{=URL(r=request,args=p.id)}}">{{=p.name}}</a><br/>
{{pass}}
On Apr 25, 2:05 pm, kike <[email protected]> wrote:
> yes, yes I defined crud and I test your first solution, but I want to
> now how do id my initial idea with out crud, to do id for any table in
> any database
> thank again for your help
>
> On Apr 25, 3:00 pm, mdipierro <[email protected]> wrote:
>
> > define crud ;-)
>
> > from gluon.tools import *
> > crud=Curd(globals(),test)
>
> > On Apr 25, 1:42 pm, kike <[email protected]> wrote:
>
> > > Thank for your rapid answer, your solution work good, but if I not
> > > defined crud how I do it the same
>
> > > On Apr 25, 2:12 pm, mdipierro <[email protected]> wrote:
>
> > > > assuming you have crud defined in model db.py
>
> > > > def index():
> > > > form=crud.update(test.persons,request.args(0))
> > > > persons=test(test.person.id>0).select(orderby=db.person.name)
> > > > return dict(form=form,persons=persons)
>
> > > > {{extend 'layout.html'}}
> > > > {{=form}}
> > > > {{for p in persons:}}
> > > > <a href="{{=URL(r=request,args=p.id)}}">{{=p.name}}</a><br/>
> > > > {{pass}}
>
> > > > On Apr 25, 1:02 pm, kike <[email protected]> wrote:
>
> > > > > Hi, I not have lot of experience about python and web2py, I need
> > > > > create a form to search some information and I need the field in that
> > > > > form content the value from a database. for example:
>
> > > > > I have the following db:
>
> > > > > test=DAL('mysql://root:r...@localhost/test1',pool_size=20)
>
> > > > > test.define_table('persons',
> > > > > Field('name', length=128),
> > > > > Field('last_name', length=128),
> > > > > Field('email', 'email'))
>
> > > > > And my idea is create a form with a field Name and when the user click
> > > > > on it display all the name where are stored in persons.name, and when
> > > > > the user select a name and click in a submit button show in another
> > > > > page the result of that.
>
> > > > > I have tried some ideas but don't work, if something cant help whit
> > > > > some example code.
> > > > > Thank for the atention.
>
> > > > > --
> > > > > Subscription
> > > > > settings:http://groups.google.com/group/web2py/subscribe?hl=en