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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

pass a variable among some frames. This is not your ordinary frames!

Status
Not open for further replies.

alinhardt

Programmer
Aug 28, 2003
7
US
I am not sure how to do this and need a little help.

I have been using some script for a Tabbed Interface I found on the net. The script example and process can be seen at the link below:

I have incorporated that script as a form to where each tab is page of the form. The reason I have used this script is because someone can fill out each page and click the tabs at the top to go to the next page or any page without refreshing the page. This way they can click the tabs at random and go back and forth between pages and everything they entered is still there before they click “submit” to submit the pages to a database. My question is how to pass a variable that is entered into a text field on the first page to the other pages. Such as if someone enters an ID number in the ID field that was created on the first page it needs to be passed to the ID field in the other pages without having to refresh the whole thing. If you check out the script example above you will notice that all the frames load when page is opened or refreshed, they are just on top of each other and brought to the front with their corresponding tab that is clicked.

I have tried a few scripts that normally work for passing variables but I cannot get them to work. If any one could assist me I would appreciate it. I can email a zip file of a 2 page test form I have been testing on to get the variable to pass from the 1st page to the 2nd page. Thanks in advance for the assistance.
 
this example may help, it shows how to pass values up to the top level page then down to a specific child window.

MAIN.htm:

<html>
<body>
<script>
function SendVal(valToSend, TargetFrame)
{
eval('window.frames(&quot;panel'+TargetFrame+'&quot;).RecieveVal(valToSend)');
}
</script>
<iframe id=panel1 src=&quot;Page1.htm&quot; height=100 width=300><br>
<iframe id=panel2 src=&quot;Page2.htm&quot; height=100 width=300><br>
<iframe id=panel3 src=&quot;Page3.htm&quot; height=100 width=300>
</body>
</html>

PAGE1.htm:

<html>
<body>
<script src=&quot;Recieve.js&quot;></script>
<form name=Test>
Pass value to middle frame<br>
<input type=Text name=Text1><input type=button onclick=&quot;parent.SendVal(document.Test.Text1.value,2)&quot;>
</form>
</body>
</html>

PAGE2.htm:

<html>
<body>
<script src=&quot;Recieve.js&quot;></script>
<form name=Test>
Pass value to bottom frame<br>
<input type=Text name=Text1><input type=button onclick=&quot;parent.SendVal(Text1.value,3)&quot;>
</form>
</body>
</html>

PAGE3.htm:

<html>
<body>
<script src=&quot;Recieve.js&quot;></script>
<form name=Test>
Pass value to top frame<br>
<input type=Text name=Text1><input type=button onclick=&quot;parent.SendVal(Text1.value,1)&quot;>
</form>
</body>
</html>

RECIEVE.js:

function RecieveVal(val)
{
window.document.Test.Text1.value = val
}

on error goto hell
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top