On Tuesday 04 March 2008 16:58:38 midtoad wrote:
> I apologize if this questions sounds PHPish but I know I can do what I
> want with PHP (not that I'm going to!).
>
> I am displaying a table of information using data from my Sqlite
> database displayed using a Kid template. So far, so good. Now I want
> to select a row in the table and display a different table based on
> the ID obtained from the row number. How do I pass that ID to the
> method that draws the new page?
>
> In PHP I would simply create a hyperlink on an element in the table
> with the row number embedded in the link. So if I wanted to do
> something with row no. 3 in the table (say, draw something using
> controllers.py method 'draw', my table display code could look like
> this:
> <tr><td><a href="/draw/3">row 3</td><td>.... </td></tr>
>
> What's the analogous way to do this in TurboGears?
Pretty much the same - because that is HTTP-protocol. All you need to do is to
create a controller "draw" that takes a parameter "row", and pass that using
the link:
<a href="/draw?row=3">...</a>
@expose(...)
@validate(validators=dict(row=Int()))
def draw(self, row=None):
....
Diez
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"TurboGears" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/turbogears?hl=en
-~----------~----~----~----~------~----~------~--~---