Forum Moderators: open

Message Too Old, No Replies

How to pass information TO a <form> via text links?

         

topsites

8:38 am on Dec 31, 2005 (gmt 0)



I searched the forum (and manually) for about 20-30 minutes but couldn't find anything to answer this.

Here's the situation:
I have category pages, each of which has a Title and I would like to add a 'buy-a-link' text link to each of these pages.
This link would lead the visitor to ONE page which would consist of an order form which would also include a pull-down selection menu of the aforementioned pages, by title... On that note, the selector can be in the form of radio or check boxes as well, aesthetics are not that big a deal, but this next part is:
What I want to do is PASS the Title information TO the form via the link so as to facilitate category selection to the visitor, the page they just came from would then come up pre-selected.

Reason being I am not in the mood to create a separate purchase page for each and every page on my site that will eventually sport said links...

I got a start on this here:
[htmlgoodies.com...]
A method which, even though it doesn't pass the information to a selector, would nevertheless be appropriate, as I am not that concerned about the aesthetics, so long the visitor has this information on the order page already there.

Any help on this would be greatly appreciated.

topsites

8:58 am on Dec 31, 2005 (gmt 0)



Ok I am getting somewhere:
First, I can pass the info thusly (but it's not a text link):

<FORM method="GET" action="NextPage.htm">
<P><INPUT type="text" name="testVariable" size="20" value="testVariable"></P>
<P><INPUT type="submit" value="Submit"></P>
</FORM>

Then, on the next page, retrieve passed info:

<script type="text/javascript">
//---------------------------------------------------------------------------------------------------------------------------------------
// All material contained within this and associated downloaded pages is the property of 4thorder(TM)
// Copyright © 2005. All rights reserved.
//
// Author: Michael Falatine ¦¦ Author's email: 4thorder@4thorder.us
//
// USAGE: You may use this script for commercial or personal use, however, the copyright is retained- by 4thorder (TM).
//
// For other free Scripts visit: [4thorder.us...]
//----------------------------------------------------------------------------------------------------------------------------------------
window.onload=getPassedInfo;

function getPassedInfo()
{
// Grab URL String
var URLString=window.location.href

//Determine length of entire string
wholePathLength=URLString.length;

// Determine length of string without the passed variable value
strippedPathLength=URLString.substring(0,URLString.lastIndexOf("=")).length+1;

// Use Substring to isolate the passed value
info= URLString.substring(strippedPathLength,wholePathLength);

// Send information to form element for viewing
document.getElementById("passedInfo").value=info
}
</script>
</HEAD>
<BODY>
<P>Passed Information: <INPUT type="text" id="passedInfo"></P>

Now...
How to do it with a text link ...?

topsites

9:09 am on Dec 31, 2005 (gmt 0)



I got it!

Page1.htm code:
----------------------------------------------
<HTML>
<HEAD>
<TITLE></TITLE>
</HEAD>
<BODY>

<A HREF="Page2.htm?Value=testVariable">Test Variable</A><BR />

</BODY>
</HTML>
----------------------------------------------
----------------------------------------------

Page2.htm code:
----------------------------------------------
<HTML>
<HEAD>
<TITLE></TITLE>

<script language="JavaScript" type="text/javascript">
//---------------------------------------------------------------------------------------------------------------------------------------
// All material contained within this and associated downloaded pages is the property of 4thorder(TM)
// Copyright © 2005. All rights reserved.
//
// Author: Michael Falatine ¦¦ Author's email: 4thorder@4thorder.us
//
// USAGE: You may use this script for commercial or personal use, however, the copyright is retained- by 4thorder (TM).
//
// For other free Scripts visit: [4thorder.us...]
//----------------------------------------------------------------------------------------------------------------------------------------
window.onload=getPassedInfo;

function getPassedInfo()
{
// Grab URL String
var URLString=window.location.href

//Determine length of entire string
wholePathLength=URLString.length;

// Determine length of string without the passed variable value
strippedPathLength=URLString.substring(0,URLString.lastIndexOf("=")).length+1;

// Use Substring to isolate the passed value
info= URLString.substring(strippedPathLength,wholePathLength);

// Send information to form element for viewing
document.getElementById("passedInfo").value=info
}
</script>
</HEAD>
<BODY>
<P>Passed Information: <INPUT type="text" id="passedInfo"></P>
</body>
</html>