Thank for your solution, it work, but it create a empty field and a
submit button with anything function, and above show all the field in
the table, and when click in one show in the field the name of the
person and the id.
My idea is the oposite, create a field like a combo box with all of
the specific field and when the user click in the submit button, show
all the field with the selected field by the user.
For example if the table x in database y have
field1,field2,field3,field4, and fieldid, and the form have a combo
box with the information of the field1 (for example), and when the
user selected one value and submit the information, show the result of
the search above, in another word show all the fields where the field1
was present.

Something like this:

Field1 : [Combo box with the information of the field1]
[submit Button]

Table with all field result of the search

Field1           Field2          Field3         Field4
Fieldid
something    something    something   something   something
something    something    something   something   something
something    something    something   something   something

In another language I now how did that, but how I say previously I not
have great experience with python, and web2py.

Thank again for all help bring to me, and my congratulation to web2py
and all person with any relation with it. Very good work


On Apr 25, 10:49 pm, mdipierro <[email protected]> wrote:
> 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

Reply via email to