I get what you are saying, you want that once the departure and arrivals 
are selected, then query the database to get the times for a particular day 
(like today).

That sounds like you would need an ajax solution. 

http://www.web2py.com/book/default/chapter/11#The-ajax-function

It asynchronously calls the url (first argument), passes the values of the 
> field inputs with the name equal to one of the names in the list (second 
> argument), then stores the response in the innerHTML of the tag with the id 
> equal to target (the third argument).


Example:

ajax('timetables', ['startdate', 'enddate'], 'timetablesdiv') 

This will call the function 'timetables' with the values of 'startdate' and 
'enddate' and store the results in the (div) element called 'timetablesdiv'.

On Sunday, November 10, 2013 2:55:34 PM UTC-7, raferbop wrote:
>
> Good days guys,
>
> I created an order form with the following fields (db.order);
>
>    - Departure Location
>    - Arrival Location
>    - Date
>    
> I wanted to display fares between each departure and arrival location, so 
> I created a fare table (db.fare_table);
>
> id      depart_city    arrival_city     fare
> 1       NYC             Miami           800.00
> 2       Miami           NYC             800.00
>
> The goal was display fares when the user selected a departure and arrival 
> location (from a drop-down box), so I wrote the following query;  
>
> fare = db((db.order.depart_from==db.fare_table.from) & 
> (db.order.arrive_to==db.fare_table.to)).select(db.fare_table.fare)    
>
> But this query returns all the fares that have been submitted to the 
> order.db table. So I would like to know if it's possible to query the 
> database, prior to the data being submitted, and if yes, how do you go 
> about doing it?
>
> Regards,
> Rafer
>

-- 
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.

Reply via email to