View Complete Thread | FoxWeb Forum Home
Date:    Msg ID:   
From:    Thread:   
This problem is not specific to the sorting situation.  Any time you want to maintain state with regular links (as opposed to forms), you need to include all the information that the requested script will need in each link.  In your particular case this means that each of the 8 header links will include 14 fields (the values passed from the 13 textboxes, plus the sort field).
The HTML code does end up looking a little confusing, but fortunately it is interpreted by software (the browser) and you never have to see it.  Also, you don't have to hand-craft each link separately.  You can simply create a common query string containing the values of the 13 text boxes and use that in each link.  The following code URLEncodes the values, to avoid problems in case they contain special characters, such as quotes and ampersands:
CommonFields = "value1=" + Server.URLEncode(Request.Form"value1")) + ;
"&value=2" + Server.URLEncode(Request.Form"value2")) + ;
"&value=3" + Server.URLEncode(Request.Form"value3")) + ;
"&value=4" + Server.URLEncode(Request.Form"value4")) + ;
"&value=5" + Server.URLEncode(Request.Form"value5")) + ;
"&value=6" + Server.URLEncode(Request.Form"value6")) + ;
"&value=7" + Server.URLEncode(Request.Form"value7")) + ;
"&value=8" + Server.URLEncode(Request.Form"value8")) + ;
"&value=9" + Server.URLEncode(Request.Form"value9")) + ;
"&value=10" + Server.URLEncode(Request.Form"value10")) + ;
"&value=11" + Server.URLEncode(Request.Form"value11")) + ;
"&value=12" + Server.URLEncode(Request.Form"value12")) + ;
"&value=13" + Server.URLEncode(Request.Form"value13"))

Once you create this variable, you can simply add it to the query string of each of the sort links.  The following code uses square brackets as string delimiters to make it easier to read, but you could also use single quotes:

html_out = html_out + ;
[<A HREF="qq1.fwx?sortorder=status&] + M.CommonFields + [">STATUS</a>] + ;
[<A HREF="qq1.fwx?sortorder=noun&] + M.CommonFields + [">NOUN</a>] + ...

FoxWeb Support Team email

Sent by Tim Bowen on 10/27/2004 05:36:48 AM:
So if a page returns 8 unique columns worth of info with each column having a hyperlinked header such as status, custname,price, date of order, date of delivery, costctr etc... to sort on, this is going to cause quite a complex html out line isn't it becasue the previous page, there are about 13 input textboxes for the user to fill out plus checkboxes and dropdown choices as well to narrow his search down.
So I will have to account for about 20 variables in an html line? This is starting to sound out of the question. Unless I am misunderstanding something.
Sent by Tim Bowen on 09/28/2004 01:22:44 PM:
I want to be able to  include clickable sort header titles to my output. So if a user gets results returned like you see here
         STATUS  NOUN                    CUST      OFFICE   EDD        JOB          PRICE
4VS5639  OPEN    TONER CARTRIDGE         BOWEN     VSOSR    10/1/04    DT1C3VS0     62.00
4VS5621  OPEN    PRINTER, LASER          BOWEN     VSOSR    10/22/04   DT1C4VS0     578.00
I want them to be able to click on STATUS header and it will sort the data by status.
Easily done?