Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

passing variables from a form in one page to a frame in another

Status
Not open for further replies.

jbanas

Programmer
Sep 18, 2007
18
US
Hey all,

I am having issues attempting to get this code to work. I can get the code to work if i just pass it to an html page. When I try to send it to the form is when i am having issues. I have tried two different ways of sending the data.

my first method is i have a form that has 3 checkboxes. When the user selects the box it will pass the variables to the test1 which will print out the variable i am looking to utilize.

<FORM action=TEST1.htm>


<center>

<TR><td> <p><input type="radio" name="RBUS" value="NATIONAL" CHECKED> National </td>
<td> <input type="radio" name="RBUS" value="CONSTRUCTION"> Construction </td>
<td> <input type="radio" name="RBUS" value="DISCOVERY"> Discovery </td>
</p>
</TR>

<TR>
<td>
<input type="image" src="
</td>
</tr>
</center>

on the test1.htm it then goes through and parses out the URL. It then returns the value after RBUS.

<script>
function PageQuery(q) {
if(q.length > 1) this.q = q.substring(1, q.length);
else this.q = null;
this.keyValuePairs = new Array();
if(q) {
for(var i=0; i < this.q.split("&").length; i++) {
this.keyValuePairs = this.q.split("&");
}
}
this.getKeyValuePairs = function() { return this.keyValuePairs; }
this.getValue = function(s) {
for(var j=0; j < this.keyValuePairs.length; j++) {
if(this.keyValuePairs[j].split("=")[0] == s)
return this.keyValuePairs[j].split("=")[1];
}
return false;
}
this.getParameters = function() {
var a = new Array(this.getLength());
for(var j=0; j < this.keyValuePairs.length; j++) {
a[j] = this.keyValuePairs[j].split("=")[0];
}
return a;
}
this.getLength = function() { return this.keyValuePairs.length; }
}
function queryString(key){
var page = new PageQuery(window.location.search);
return unescape(page.getValue(key));
}
function displayItem(key){
if(queryString(key)=='false')
{
result.innerHTML="you didn't enter a ?rbus=value querystring item.";
}else{
result.innerHTML+=queryString(key)+"<BR>";
}
}
</script>
<body onload="displayItem('RBUS');">

<div id=result></div>

This code is utilized in my left frame. How can i pass a value in the form to the left frame. any help would be great
thanks
 
So you're saying the code works, but you don't know how to get the form in the right frame to submit to the left frame. Is that correct? If so, you can just modify your form tag:
Code:
<FORM action="TEST1.htm" target="yourLeftFrameName">

Adam
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top