Thanks Dave.
Yes, I want to display the categories in the dropdown and based on the
selected one, I get all the items from the DB based on the category to
display. I did search for it, but I was not able to find anything relevant.
Since this is in the same form and initially the results should be empty.
After the user selected something, then I need to capture the request
variables and use that to query the DB in the same page. I am sure it is
possible, but have not seen it in examples(or I might have missed it).
If passing the request to the next page altogether is easier, I am open for
that too. Thanks again.
On Thursday, October 24, 2013 4:10:44 PM UTC-4, Dave S wrote:
>
> On Thursday, October 24, 2013 12:30:00 PM UTC-7, Vj wrote:
>>
>> All,
>>
>> I am trying to have a select (multi select drop down) option in the home
>> page and display the results on the home page itself(below the select box).
>>
>> I am able to pull the data from the Table 1 and display in the select
>> box. I am not able to use the selected options to query Table 2 and display
>> the results (though I could display all the data from this table) using the
>> selected options int he select box. My code is below
>>
>>
> I am not sure what your question is. Do you want the user to select
> something from Table 1 (from the select box), and use that to select what
> to display from Table 2?
>
> (If so, I don't know the answer, but some of the topics here about
> multiple forms might be relevant.)
>
> /dps
>
>
>
>> default.py
>> def index():
>> form3 = SQLFORM.factory(Field('select_category',requires=IS_IN_DB(
>> db,db.table1.id,'%(category)s',multiple=True)))
>> records = db(db.table2.category_id.belongs(1,2)).select() """I
>> just tried using 1,2 for testing"""
>> return dict(form3=form3,records=records,message=T('Info'))
>>
>>
>>
>> index.html
>> {{extend 'layout.html'}}
>>
>> {{=form3}}
>> {{=records}}
>>
>> Here form3 has the select box and the button and once I click the button
>> the result set from the table should be displayed as a list. The code I
>> have displays all the records from table 2(some of the text is big to be
>> displayed). Is there a setting where I can display long text also?
>>
>> Thanks.
>>
>>
>>
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.