Web Connection
Reposting a page
Gravatar is a globally recognized avatar based on your email address. Reposting a page
  Alec Gagne
  All
  Apr 12, 2018 @ 11:09am

I'm a bit of a newbie to Web Connect so be gentle..

This might be simple but I am wanting to know how to re-post a page so I can get the results of input gathered via a POST to be reflected as a URL QueryString ( key=value&key2=value2 ).

I want to use data collected via a POST method on a page (PageA) to search the VFP database in a separate FUNCTION() to generate a summary results page (PageB) that has links in it. However, when the user navigates to some subpage (PageC, PageD, etc.), the use of the browser's BACK button fails to get back to the summary results page (PageB) because the URL for that created page does not have the search criteria data as part of the URL QueryString.

So I want to capture data via a <form action method="POST" of a page (PageA), then call back the same page (PageA) to gather the results of that POST then programmatically create the url with the query string. This I understand and know how to do, but how do I then push or repost the value of the new page with the querystring? Here is an example:


**********************
* This function gather the search criteria
FUNCTION PageA()

lcVar1 = Request.Form("txtLName")  && Required
lcVar2 = Request.Form("txtFName")

IF !EMPTY(lcVar1) 
   MyNewPage = "PageB.wc?key1=" + lcVar1 + "&key2=" + lcVar2
   HOW_DO_I_LOAD_THIS_PAGE(MyNewPage)
ENDIF

<form action="PageA.wp" method="POST">
     ..more code 
     && user inputs data and we repost this page to collect it
     && then use the data collected to create a query string on a URL
     && for our new page
</form>
ENDFUNC

**********************
* This function uses the url QueryString data to search the database and
* produce a summary results page.
**********************
FUNCTION PageB()

lcLName = Request.QueryString("key1")
lcFName = Request.QueryString("key2")
 
SELECT HREF([DetailPage.wc?id=] + id, lname) AS Last_Name from MyTable where Lname = lcLName and fname =lcFName into cursor TQuery

lcHtml = HtmlDataGrid("TQUery")  && create summary list with links

Response.Write(lcHtml)

ENDFUNC 

Maybe there is a better way to accomplish this task but I simply want to assemble a URL and push it back into the system so that the appropriate function will be called and the QueryString can be harvested. The result will be a programmatically generated page with the search criteria for that page represented in the QueryString of the URL line so the browsers BACK button can always get back to it.

Thanks

Alec

Gravatar is a globally recognized avatar based on your email address. re: Reposting a page
  Rick Strahl
  Alec
  Apr 12, 2018 @ 12:39pm

I think what you're looking for is Response.Redirect()

This lets you redirect to a different http request from the middle of an existing request.

+++ Rick ---

Gravatar is a globally recognized avatar based on your email address. re: Reposting a page
  Alec Gagne
  Alec
  Apr 13, 2018 @ 07:50am

Perfect. Thank you!!

Alec

© 1996-2024