View Full Version : Form Values

02-04-2004, 04:52 PM
I am currently working on a site which has a special offers page and an ordering page. When you are on the special offers page, you are shown the monthly offer and are given the option to order it.

On the ordering page, there are several form fields to add in manually, such as Part Number and Description. What I would like to do is when you click on the order link on the special offers page, the two fields Part Number and Description are filled out on the ordering page.

I have managed to pass the values on to the page using this code........

<a href="ordering.asp?partno=4696-114-0&desc=Ratcliff Starter Soleniod">click here</a>

<script type="text/javascript">
function parseSearchString()
var pairs=unescape(location.search.substring(1).replace(/\+/g," ")).split('&');
for (var i=0;i<pairs.length;i++){
var pair = pairs[i].split('=');
var search = new parseSearchString();

//this will output all the passed variables
document.write("These are the variables passed:<br />");
for (o in search) document.write(o + " = " + search[o]+"<br />");

.....but I have no idea how to make this fill out the form input fields??

Hope you can help.

Many thanks


Mr J
02-04-2004, 08:47 PM
An example here might help you out


02-05-2004, 04:07 AM
Since you are using ASP, why not do the parsing in the server-side?

<input type="text" name="partno" value="<%=partno%>">
<input type="text" name="desc" value="<%=desc%>">

Is that what you want?

02-05-2004, 10:27 AM
Perfect Glenn, thanks a lot, you've saved my bacon!