# Quick HTML/Scripting Problem (frames and forms)

**URL:** <https://boards.straightdope.com/t/quick-html-scripting-problem-frames-and-forms/296221>\
**Category:** Factual Questions\
**Created:** [March 25, 2005, 4:30pm UTC](https://boards.straightdope.com/t/quick-html-scripting-problem-frames-and-forms/296221 "2005-03-25T16:30:30Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Omniscient](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/omniscient/32/3290_2.png) [@Omniscient](https://boards.straightdope.com/u/Omniscient)\
**Post date:** [March 25, 2005, 4:30pm UTC](https://boards.straightdope.com/t/quick-html-scripting-problem-frames-and-forms/296221/1 "2005-03-25T16:30:30Z")

</div>

So I’m building this webpage that has a form built into a frame. Its ASP with VBScripting, FTR.

The frameset has two frames, one at the top and one at the bottom. The top frame is a form with drop downs and a submit button. The action for the for submission is the main frameset. When the form is submitted variables are passed to the frameset, then to the frames themselves. The top frame is reloaded and the bottom frame calls a Crystal report based on the variable passed in.

Here’s the problem. When I submit the form normally, it doesn’t want to refresh the page and the Crystal report isn’t called. When I submit the form but change the target to “\_blank” to open a new window everything works grea. However I don’t want to be opening new windows, I want to reuse the same window. when I set the target to “\_self” it does the same thing as without a target setting.

I’m thinking there’s probably some quick VB or Javascript solution to this that I just can’t think of. Any thoughts from the vast developer community here? Thanks.

---

<div class="post-metadata">

**Author:** ![johncole](https://avatars.discourse-cdn.com/v4/letter/j/5f9b8f/32.png) [@johncole](https://boards.straightdope.com/u/johncole)\
**Post date:** [March 25, 2005, 6:17pm UTC](https://boards.straightdope.com/t/quick-html-scripting-problem-frames-and-forms/296221/2 "2005-03-25T18:17:12Z")

</div>

From the MSDN library:

[target property](http://msdn.microsoft.com/library/default.asp?url=/workshop/author/dhtml/reference/properties/target.asp)

Have you tried naming the bottom frame?

---

<div class="post-metadata">

**Author:** ![Omniscient](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/omniscient/32/3290_2.png) [@Omniscient](https://boards.straightdope.com/u/Omniscient)\
**Post date:** [March 25, 2005, 7:02pm UTC](https://boards.straightdope.com/t/quick-html-scripting-problem-frames-and-forms/296221/3 "2005-03-25T19:02:40Z")

</div>

I’m not quite sure what you mean by “naming”. I’ll paste some code here if that helps.  
Here’s the frameset (ITReportsFrameSet.asp):

```auto

<% @Language=VBScript %>
<!--#INCLUDE file="include/dbaccess.asp"-->

<%

if Request.ServerVariables("REQUEST_METHOD") = "POST" then

	ManagerName = Request.Form("ManagerName")
	ReportPeriod = Request.Form("ReportPeriod")
	Grouping = Request.Form("grouping")
	MonthNum = Request.Form("MonthNum")

	CrystalUrl = Report.rtp

%>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<frameset rows="140,100%" cols="*">
  <frame src="ITReportsTopFrame.asp?submitted=true&ManagerName=<%=ManagerName%>&mth=<%=monthNum%>&ReportPeriod=<%=ReportPeriod%>&Grouping=<%=Grouping%>">
  <frame src="<%=CrystalUrl%>">
</frameset>
</html>

<%
else
%>

<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<frameset rows="140,100%" cols="*">
  <frame src="ITReportsTopFrame.asp">
	<frame src="Blank.htm">
</frameset>
</html>

<%
end if
%>

```

Here’s the form (ITReportsTopFrame.asp):

```auto

<% @Language=VBScript %>
<!--#INCLUDE file="include/dbaccess.asp"-->
<html><!-- #BeginTemplate "/Templates/ITtemplateTopFrame.dwt" -->
<head>
<!-- #BeginEditable "doctitle" -->
<title>Individual Travel Reports</title>
<!-- #EndEditable -->
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body bgcolor="#FFFFFF" text="#003366" link="#003366" vlink="#003366" alink="#CC0033">
<table width="100%" border="0" height="11%">
    <td colspan="3" valign="top" align="left" height="72"><!-- #BeginEditable "Main%20Body" -->
      <form name="LoadReport" method="POST" action="ITReportsFrameSet.asp" target="_blank">
		<table width="100%" border="0">

<!--- Bunch of junk I edited out --->

            <td height="100%">
              <input type="submit" name="GetReports" value="Get Report">
            </td>
            <td width="25" height="100%"> </td>
          </tr>
        </table>
	</form>
      <!-- #EndEditable --> </td>
  </tr>
</table>
</body>
<!-- #EndTemplate --></html>

```

As you can see, I do use the target property already. This version has it calling “\_blank” which works fine, however it opens a new window. When I change that to “\_self” the frames don’t do a full reload. Can I force it to do that somehow? Perhaps some javascrip or VB script in the frameset page the calls for a new version of the frames onLoad?

_shrugs_

---

<div class="post-metadata">

**Author:** ![johncole](https://avatars.discourse-cdn.com/v4/letter/j/5f9b8f/32.png) [@johncole](https://boards.straightdope.com/u/johncole)\
**Post date:** [March 25, 2005, 7:31pm UTC](https://boards.straightdope.com/t/quick-html-scripting-problem-frames-and-forms/296221/4 "2005-03-25T19:31:35Z")

</div>

From MSDN library:

[NAME property](http://msdn.microsoft.com/workshop/author/dhtml/reference/properties/name_0.asp)

> [@](#):
>
> \<FRAMESET\>  
> \<FRAME NAME=“Left” SRC=“blank.htm”\>  
> \<FRAME NAME=“Right” SRC=“contents.htm”\>  
> \</FRAMESET\>

This associates a **name** with each **frame**.

Then from my earlier link, use “target = **name** ” to tell the system where to open the report.

---

<div class="post-metadata">

**Author:** ![Omniscient](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/omniscient/32/3290_2.png) [@Omniscient](https://boards.straightdope.com/u/Omniscient)\
**Post date:** [March 25, 2005, 8:43pm UTC](https://boards.straightdope.com/t/quick-html-scripting-problem-frames-and-forms/296221/5 "2005-03-25T20:43:44Z")

</div>

I’ll try it, but i’m not having trouble with where to open the report. Thats fine, it’s getting that destination to reload itself which seems to be the hang up.

---

<div class="post-metadata">

**Author:** ![johncole](https://avatars.discourse-cdn.com/v4/letter/j/5f9b8f/32.png) [@johncole](https://boards.straightdope.com/u/johncole)\
**Post date:** [March 25, 2005, 9:30pm UTC](https://boards.straightdope.com/t/quick-html-scripting-problem-frames-and-forms/296221/6 "2005-03-25T21:30:01Z")

</div>

Sorry, I guess I did not read the question properly.

Have you tried using the **focus** method? (But that only works after the element has finished loading.)

Please let me know what is the result of naming the target.

---

<div class="post-metadata">

**Author:** ![Omniscient](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/omniscient/32/3290_2.png) [@Omniscient](https://boards.straightdope.com/u/Omniscient)\
**Post date:** [March 28, 2005, 4:57pm UTC](https://boards.straightdope.com/t/quick-html-scripting-problem-frames-and-forms/296221/7 "2005-03-28T16:57:56Z")

</div>

Well, I renamed the frames to no avail. The big thing here is that the target property is for where the form action loads. In this case the form calls the frameset, not the frame. Ergo, naming the frames is pretty pointless.  
Also, the focus method isn’t relevant either since it applies to where the cursor goes and doesn’t affect the page load at all. Still struggling here.

---

<div class="post-metadata">

**Author:** ![Omphaloskeptic](https://avatars.discourse-cdn.com/v4/letter/o/bcef8e/32.png) [@Omphaloskeptic](https://boards.straightdope.com/u/Omphaloskeptic)\
**Post date:** [March 28, 2005, 5:52pm UTC](https://boards.straightdope.com/t/quick-html-scripting-problem-frames-and-forms/296221/8 "2005-03-28T17:52:08Z")

</div>

I’m not sure I understand what’s going on (never having used either VBscript or ASP). But it looks like you’re trying to reload the entire frameset within the top frame (the POST target of \_self is on the form in the top frame, right?). In this case your new bottom frame (the one you’re trying to fill with the reports) will be hidden underneath the old one, which doesn’t ever change. (You can check to see if this is what’s happening by changing your frameset row dimensions from “140,100%” to “50%,50%”; see if the top frame gets subdivided every time you post.)

It sounds like you want a POST target of \_parent, to replace the enclosing frameset with the newly-reloaded frameset. Does that make sense, or am I misunderstanding what you’re trying to do?

---

<div class="post-metadata">

**Author:** ![Omniscient](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/omniscient/32/3290_2.png) [@Omniscient](https://boards.straightdope.com/u/Omniscient)\
**Post date:** [March 28, 2005, 6:49pm UTC](https://boards.straightdope.com/t/quick-html-scripting-problem-frames-and-forms/296221/9 "2005-03-28T18:49:05Z")

</div>

Actually it looks like you nailed it. I figured it out on my own doing a little research and was just about pop in here and wrap it up saying problem solved. It was the “\_parent” target which fixed it as a matter of fact. I was a little unclear as why that solved the issue once I figured it out, but it did. Reading your post I think I see why now. Thanks.
