Pass cookie value back to server?

M

Martin

I have a web page that displays records from a database. I want to
allow the user to specify his own "page size" - that is, the number of
records to be displayed on a given page. I have a place set up for him
to enter a value and save it to a cookie. My problem is, I can't
figure out a good, simple way to pass that value back to the server.

The page is accessed in various ways: it's first viewed by selecting
it from a javascript menu. Then the page itself contains a form with a
series of buttons that allow the user to jump to a specific page above
or below the current page. There are also "sort links" at the top of
the columns of data which refresh the data sorted in a different way.
In all of these cases, I will need to pass the page size back to the
server.

I tried storing the page size in a hidden input field. This works but
it's not available on the first request (from the menu). I thought
about passing in the value as a query string (mypage.htm?PS=123) but I
can't figure out how to attach the value to all of the various
requests (menu, form and links).

Is there an easy way to do this?

Can someone possibly point me to an example that I might be able to
study?

Thanks.
 
A

Arnulf Sortland

Martin skrev:
I have a web page that displays records from a database. I want to
allow the user to specify his own "page size" - that is, the number of
records to be displayed on a given page. I have a place set up for him
to enter a value and save it to a cookie. My problem is, I can't
figure out a good, simple way to pass that value back to the server.

The page is accessed in various ways: it's first viewed by selecting
it from a javascript menu. Then the page itself contains a form with a
series of buttons that allow the user to jump to a specific page above
or below the current page. There are also "sort links" at the top of
the columns of data which refresh the data sorted in a different way.
In all of these cases, I will need to pass the page size back to the
server.

I tried storing the page size in a hidden input field. This works but
it's not available on the first request (from the menu). I thought
about passing in the value as a query string (mypage.htm?PS=123) but I
can't figure out how to attach the value to all of the various
requests (menu, form and links).

Is there an easy way to do this?

Can someone possibly point me to an example that I might be able to
study?

Here are an example where user can choose between listing "vareliste"
1 or 2 colums "1 / 2 spalter": http://rlb.no/vare (lower right corner)

Select box: function pr_pg_select() onChange: function set_pg(idv)
http://rlb.no/eKremmern/js/Vare.js

arnulf @ http://rlb.no/en
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top