[OT] HTML Form/Page and Navigation with multiple buttons
bruno.42.desthuilliers at wtf.websiteburo.oops.com
Fri Jun 1 09:23:02 CEST 2007
mosscliffe a écrit :
> Excellent - thanks for all your help. I now have a form created by a
> python script executing an HTML page,
s/executing/generating/, I think...
> doing everything I need, except
> for Session Data (probably use hidden fields ?? future research)
HTTP is a stateless protocol, so you either have to pass *all* the
relevant context from request to request or use server-side 'sessions' -
which usually means using a cookie to store the session identifier on
the client-side, and use some kind of persistant storage (flat files,
shelves, dbm, sql dbms, whatever) on the server side.
> the actual paging logic !!!
> If I use a link. I have to add all my hidden fields to the query
If you use a link, you don't use "hidden fields" at all. And yes, you
have to add all the relevent context to the query string - which is
*exactly* what happens if you use a form with hidden fields and submit
the form with the GET method (which is the appropriate one here, since
you don't want to submit data, but get data).
> otherwise cgi.FieldStorage(), does not return the hidden
> fields. This would also mean users see all the hidden field data.
They see exactly the same thing. "hidden" fields are not a mean to store
> Is there another way, other than a cookie ?
If you want server-side sessions, you need to pass the session id from
request to request. The two possible solutions are to pass this id as
part of the request (either in the query string for GET requests or in
> Why is a link better than a button ?
Because links are the normal way to navigate from page to page.
> I have been using 'post' for my form,
"POST" requests are for submitting data to the server (sending comment,
ordering some products, etc). Please read the HTTP specs.
> to eliminate the displaying of
> field values.
Which "displaying" ? In the url ? Most users just don't care, and those
who care are able to read the HTML source code and read these values.
Don't waste your time with this. Did you bother having a look at what
google urls looks like ?
> I accept I am quite niave about FORM/HTML logic.
This is more about the HTTP protocol than about html forms.
And FWIW, none of this has anything to do with Python, so it may be good
idea to post other http/ html related questions to a more appropriate
More information about the Python-list