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

Submitting a form to 2 frames

Status
Not open for further replies.

lin45

Technical User
Dec 19, 2002
14
GB
Can anyone help me - I am trying to submit a form to 2 frames in order that both frames (which are ASP pages) can do some validation against the database and display the required information. Presently I am using the undernoted function with the form submitting to the frameset page

function InfoPage(Select)
{
document.menu.Selection.value=Select;
document.menu.action = "sample.asp";
document.menu.target = "topframe";
menu.submit();
document.menu.action = "pdfframe.asp";
document.menu.target = "bottomFrame";
menu.submit();
return false;
}

however this is taking the required fields allowing the validation through and information to be displayed correctly but opening up two new windows and not displaying them in the frameset

Many thanks for any assistance
 
Something like this might help you, I suppose you are using ASP or something alike?
There are 5 files, the starting point is "frameSet.htm"


frameSet.htm
<html>
<frameset rows = &quot;250, *&quot;>
<frame name = &quot;up&quot; src = &quot;up.htm&quot; marginwidth = &quot;10&quot; marginheight = &quot;10&quot; frameborder = &quot;10&quot;>
<frameset cols = &quot;50%, *&quot;>
<frame name = &quot;left&quot; src = &quot;start.htm&quot; marginwidth = &quot;10&quot; marginheight = &quot;10&quot; frameborder = &quot;10&quot;>
<frame name = &quot;right&quot; src = &quot;start.htm&quot; marginwidth = &quot;10&quot; marginheight = &quot;10&quot; frameborder = &quot;10&quot;>
</frameset>
</frameset>
</html>

start.htm
<html>
Empty starting page
</html>

up.htm
<script language = &quot;JavaScript&quot;>
function sendIt()
{
theText = document.menu.text1.value;
theOption = document.menu.select1.value;
parent.frames[&quot;left&quot;].location = &quot;testLeft.asp?theText=&quot; + theText + &quot;&theOption=&quot; + theOption;
parent.frames[&quot;right&quot;].location = &quot;testRight.asp?theText=&quot; + theText + &quot;&theOption=&quot; + theOption;
}
</script>

<html>
<form name = &quot;menu&quot; onSubmit = &quot;sendIt()&quot;>
<input type = &quot;text&quot; name = &quot;text1&quot; value = &quot;&quot;></input>
<br>
<select name = &quot;select1&quot;>
<option value = &quot;1&quot;>Option 1</option>
<option value = &quot;2&quot;>Option 2</option>
<option value = &quot;3&quot;>Option 3</option>
<option value = &quot;4&quot;>Option 4</option>
<option value = &quot;5&quot;>Option 5</option>
</select>
<br>
<input type = &quot;submit&quot; value = &quot;Send&quot;></input>
</form>
</html>

testLeft.asp
<%
theText = request.queryString(&quot;theText&quot;)
theOption = request.querystring(&quot;theOption&quot;)

response.write &quot;Testing in the <b>left</b> frame&quot;
response.write &quot;<br><br>&quot;
response.write &quot;Your text: &quot; & theText
response.write &quot;<br>&quot;
response.write &quot;Your option: &quot; & theOption
%>

testRight.asp
<%
theText = request.queryString(&quot;theText&quot;)
theOption = request.querystring(&quot;theOption&quot;)

response.write &quot;Testing in the <b>right</b> frame&quot;
response.write &quot;<br><br>&quot;
response.write &quot;Your text: &quot; & theText
response.write &quot;<br>&quot;
response.write &quot;Your option: &quot; & theOption
%>



vlad
 
Thanks for this vlad,

have tried out the above code and it works well if you are starting from a frames page, but unfortunately I am trying to pass variables from a single asp page to a 2page frameset - can you help with the correct coding for this (I am a complete novice when it comes to code)

Many thanks.

Lin

 
OK, &quot;testLeft.asp&quot; and &quot;testRight.asp&quot; remain the same, and you start now with &quot;startPage.htm&quot;.

The options for the frame in &quot;makeFrames.asp&quot; are just in case, you can leave them out or change them.

startPage.htm
<html>
<h3>Single asp page</h3>
<form name = &quot;menu&quot; action = &quot;makeFrames.asp&quot;>
<input type = &quot;text&quot; name = &quot;text1&quot; value = &quot;&quot;></input>
<br>
<select name = &quot;select1&quot;>
<option value = &quot;1&quot;>Option 1</option>
<option value = &quot;2&quot;>Option 2</option>
<option value = &quot;3&quot;>Option 3</option>
<option value = &quot;4&quot;>Option 4</option>
<option value = &quot;5&quot;>Option 5</option>
</select>
<br>
<input type = &quot;submit&quot; value = &quot;Send&quot;></input>
</form>
</html>

makeFrames.asp
<%
theText = request.queryString(&quot;text1&quot;)
theOption = request.querystring(&quot;select1&quot;)
%>

<html>
<frameset cols = &quot;50%, *&quot;>
<%
response.write &quot;<frame name = 'left' src = 'testLeft.asp?theText=&quot; & theText & &quot;&theOption=&quot; & theOption & &quot;'marginwidth = '10' marginheight = '10' frameborder = '10'>&quot;
response.write &quot;<frame name = 'right' src = 'testRight.asp?theText=&quot; & theText & &quot;&theOption=&quot; & theOption & &quot;'marginwidth = '10' marginheight = '10' frameborder = '10'>&quot;
%>
</frameset>
</html>


vlad
 
One last question, I have a variable ( =strBulletinNotes(i) ) being pulled out of the database which is the path to the page I would like to display in the second frame, - is it possible to replace testRight.asp with this variable and if so what is the syntax for it?


Thanks from a total novice!!!
 

Certainly, modify the makeFrames.asp file like this (look at the second line with response.write):

<%
theText = request.queryString(&quot;text1&quot;)
theOption = request.querystring(&quot;select1&quot;)

%>

<html>
<frameset cols = &quot;50%, *&quot;>
<%
response.write &quot;<frame name = 'left' src = 'testLeft.asp?theText=&quot; & theText & &quot;&theOption=&quot; & theOption & &quot;'marginwidth = '10' marginheight = '10' frameborder = '10'>&quot;
response.write &quot;<frame name = 'right' src = '&quot; & strBulletinNotes & &quot;'?theText=&quot; & theText & &quot;&theOption=&quot; & theOption & &quot;'marginwidth = '10' marginheight = '10' frameborder = '10'>&quot;
%>
</frameset>
</html>

Note that the variable strBulletinNotes has to be initialized before that code runs.



vlad
 
I have initalised the variable by opening up the database connection and reading in the value of the strBulletinNotes(i) variable, thereafter I have the undernoted code in the makeframes.asp page, however, whilst getting one step further it is not fully working. It is now opening up a totally blank html page - any ideas?

I have had the page working perfectly fine when I submit the previous page direct to the strBulletinNotes(i), but need to have it going to the frames page.

Many thanks

<%
theText = request.queryString(&quot;name&quot;)
theOption = request.querystring(&quot;Selection&quot;)
summary = strBulletinNotes(i)
%>
<html>
<frameset rows=&quot;180,*&quot; frameborder=&quot;NO&quot; border=&quot;0&quot; framespacing=&quot;0&quot;>
<%
response.write &quot;<frame name = 'left' scrolling = 'no' src = 'sample.asp?theText=&quot; & theText & &quot;&theOption=&quot; & theOption & &quot; 'marginwidth = '10' marginheight = '10' frameborder = '10'>&quot;
response.write &quot;<frame name = 'right' src = '&quot; & summary & &quot;' ?theText= &quot; & theText & &quot; &theOption= &quot; & theOption & &quot; 'marginwidth = '10' marginheight = '10' frameborder = '10'>&quot;
 
Your variable is probably not right initialized, I suppose it is empty.

By the way, if this all the code you have in makeFrames.asp, it can not work.

What is strBulletinNotes(i) and where do you read it from the database? In another file? You have to somehow pass it as a parameter, maybe as a hidden field in the form, otherwise you have nothing in it.

And what is &quot;i&quot;? Do you have to use an array?

If you cant find the answer, place the whole code of makeFrames.asp and of the file that calls it, I will try to help?

vlad
 
Thanks - i managed top sort it out - was passing i nothing, because of a stupid oversight - calling something the wrong variable (had put an &quot;s&quot; at the end of it)

couldn't have done it without your help.

Cheers
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top