[OT] Re: HTML Form/Page and Navigation with multiple buttons

Bruno Desthuilliers bruno.42.desthuilliers at wtf.websiteburo.oops.com
Thu May 31 10:30:40 EDT 2007


mosscliffe a écrit :
> I am struggling to find a python example of the scenario - I have.
> 
> I have a python script, which generates a page with a search button
> (actually an input field).
> 
> The data from the above submissions is interrogated and the same
> script produces a new search option and the a page of results from the
> previous search request.  -  as done by Google's Main search page.
> 
> The user then has the option of  a new search or navigating to a
> different page of results with the usual Start, Previous, Next and
> Last Buttons.
> 
> How can I identify which button has been pressed.  Do I need a
> separate form for each button and hide all the relevant session fields
> in each form or is there a way of identifying which button has been
> pressed on the page.

This is not really a Python problem - would be the same with any 
server-side techno...
<OT>
You shouldn't use buttons for navigation, but links. The simplest 
solution is to pass all the relevant data into the query string (the 
?key=val&key2=val2&etc=etc part of the url). In your case, this would be 
something like resending all the search params, and adding the current 
page and the action (ie 'action=next' or 'action=first' etc...)
</OT>




More information about the Python-list mailing list