[cgiapp] Q: Any guidelines for paging thru db records via CGI params?

Ron Savage ron at savage.net.au
Sun May 25 21:37:41 EDT 2008


Hi Folks

Let's say I offered the user a form with 2 fields, id and (Winemaker's)
name.

The user enters B% for the name's value, and, using Rose, I know there
are 18 matching records.

But it happens I'm using a per_page of 10 (say) to call
get_winemaker_iterator(), so the first call returns records 1 .. 10 to
the user.

What's a good way to display buttons so the user can page forward to get
records 11 .. 18, and (later) back from page 2 to page 1?

Alternatives:

o I could pre-populate the form, and offer Next and Previous buttons,
besides the Submit button. Then I'd have to also offer a Clear button
for when the user wishes to start a new search

o I could not use that form, but create a separate one, with previous
input used to populate hidden fields, so the only fields visible are
Previous and Next

o I could use a cookie to send the previous input around, and again
offer just Previous and Next (separate from the original form)

o I could use non-cookie sessions, but otherwise work as per the
previous item

Comments?

-- 
Ron Savage
ron at savage.net.au
http://savage.net.au/index.html




More information about the cgiapp mailing list