September 19, 2007, 11:35 AM
jbanas6passing &variables to a frame
I have a form that submits amper variables to a fex which works fine. I would like the html page to call another html page that has 2 frames in it(a left frame and a main frame). When i submit the variables they seem to get lost in passing. Can anyone offer any suggestions on how to pass &variables to a frame ?
September 19, 2007, 11:52 AM
Francis MarianiYou cannot pass variables to an HTML page - that's a basic tenet of HTML. You can, however, store the variables in a cookie or pass JavaScript variables from one HTML page to another.
The easiest method in the WebFOCUS world is to call a WebFOCUS program instead of an HTML page, with the program containing the HTML within -HTMLFORM BEGIN and -HTMLFORM END statements.
Francis
Give me code, or give me retirement. In FOCUS since 1991
Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
September 19, 2007, 05:26 PM
GizmoYou can access the parameters that were passed to the page using javascript. The values are in location.search and must be unescaped and parsed.
I set up a main page to take the parameters as follows
<html>
<body>
<form action='frameset.html' method=get>
Name:<input type=text name=username><br>
Age:<input type=text name=age><br>
<input type=submit value=Run>
</form>
</body>
</html>
Then my frame set contained
<frameset cols="10%, *">
<frame src='leftframe.html'>
<frame src='rightframe.html'
</frameset>
The right frame contained
<script>
document.write(unescape(parent.parent.location.search.substring(1, parent.parent.location.search.length)));
</script>
You need to use parent twice since the first parent would be the frameset and the second parent would be the html page that contains the frameset for which you called.
Once you have the location.search string, you can then use javascript using indexOf and substring to get each of the values.
September 20, 2007, 07:37 PM
susannahwow. thanks for that, Giz.
September 21, 2007, 08:40 AM
jbanas6thanks Gizmo, that worked perfectly
September 21, 2007, 04:37 PM
Carol DobsonGood post Jon!