>I got a tip from someone about using an include file that has a form with hidden fields to pass data from page to page. This way, I wouldn't have to have a hidden field for every field on every page I wanted to save values from. I am simply trying to maintain three or four values across pages. I can't figure out how to get values into and out of the form fields in the include file. I need to be able to store the values on one page, then retrieve them on the next. Any suggestions will be greatly appreciated. I am using VBScript (IE only platforms) and IIS4.0. I think there is some fundamental concept I am missing here - this doesn't look that difficult!
>
>Paul
I'm not sure I understand what you're trying to do, but if you are trying to pass these values to the client and then back to the server between pages, keep in mind that this would only work if the form in the included file is
submitted. In other words, whatever link you provide to move from page to page has to submit this hidden form.
As far as setting the values from the server, it's easy. Include files are added to the flow of your ASP page before the code in the page is processed, so you can have in your include file:
< form id="myform" method="post" action="< %=myaction%>">
< input type="hidden" name="fld1" value="< %=myfld1%>">
< input type="hidden" name="fld2" value="< %=myfld2%>">
... etc.
< /form>
This include file can have any name you want. Even though it has code, the extension can be HTM, since it will be added to the "hosting" ASP page, and processed with it as a whole.
Then in the "hosting" page, you can retrieve and set the values like this (again, this works only if the form is submitted from the client):
myfld1 = Request.Form("myfld1")
myfld2 = Request.Form("myfld2")
... etc.
myaction = "nextpage.asp"
< !-- #include-file="myincudefile.htm" -->
... etc.
Of course, there has to be an initial page that sets the initial values (myfld1, myfld2) for the rest of the pages to retrieve from the form collection.
The HTML code in this "hosting" page will need to include a link similar to this:
< a href="." onclick="document.myform.submit();return false">Next Page< /a>
Hope this helps.
Andres M. Chiriboga, MCSE, MCP+I