Wrox Programmer Forums
|
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old December 7th, 2005, 08:54 AM
Registered User
 
Join Date: Dec 2005
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default parsing form data from frame to other frame

Hello everybody,
i have a question which might seem a bit stupid, but it's been bugging me now to long.

i have 3 pages :

frameset.htm ( containing frameset of next 2 pages)

<code>

<frameset cols="*" rows="300,*" border="0" framespacing="0" frameborder="NO">
  <frame src="form.htm" name="zoek" scrolling="NO" marginwidth="0" marginheight="0" frameborder="NO" >
  <frame src="result.asp" name="result" scrolling="yes" marginwidth="0" marginheight="0" frameborder="NO">
</frameset>

</code>


form.htm (Very basic form)

<code>

<form action="result.asp" method="post" enctype="multipart/form-data" name="form" target="_blank">
<input name="text" type="text" >
<input name="submit" type="submit" >
</form>

</code>

result.asp

<code>

<%
dim test

test = Request.Form("text")
Response.Write(test)
%>

</code>


i just can't seem to get the value from one frame to another.
A Little help would be greatly appr..



 
Old December 8th, 2005, 02:49 PM
Friend of Wrox
 
Join Date: Nov 2004
Posts: 1,621
Thanks: 1
Thanked 3 Times in 3 Posts
Default

Of course, the contents of the form in one page is not directly available to the page in frame "result" (but you know that, of course...).

But you can address "result" from "zoek".

If you change your button so that it is not a submit button, but use it to run code within form.htm, you can directly send info to fram "result".
Using the parent, you can get to the frameset, which has two objects, "zoek" & "result"
using result, you can address controls on the page within that frame.

So if relult .asp were
Code:
<%
  dim test  

  test = Request.Form("text") 
  Response.Write(test)
%>
<html>
<body>
    <form method="post">
        <input name="box" type="text">
    </form>
</body>
</html>
you should be able to fill in Parent.result["box"].value from code running in form.htm.
(I forget the exact syntax: parent["result]["box"].value, maybe?)

Hopefully this will get you on the right track.

All of this is client-side, of course. (By the way, use square brackets to modify the appearance of your posts, like—to initiate a code listing—[ c o d e ] . . . [ / c o d e ] {but without the spaces}.)
 
Old December 8th, 2005, 04:24 PM
Registered User
 
Join Date: Dec 2005
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default

dear brian ,

thank you very much for your response.
i though the same thing to, the problem is;

i can't reload result.asp , ( javascript top.opener! ), so i realy need my results server-side.
I will post the complete code, altough it's pretty much!

[code formfillerframe.asp]

<%
fieldname = Request.QueryString("fieldname")
dummyname = Request.QueryString("dummy")
tabelnaam = Request.QueryString("tbl_name")
loopcount = 1


%>
<HTML>
<HEAD>
<SCRIPT LANGUAGE="JavaScript">
<!--
function updateParent(id,naam) {

  opener.document.editform.<%=fieldname%>.value = id;
  opener.document.editform.<%=dummyname%>.value = naam;
  self.close();
  return false;
}
-->
</SCRIPT>
<link rel="stylesheet" href="/css/stylesheet.css" type="text/css">
</HEAD>
<title>Boot Translations CRM -> Selecteer Pagina</title>

</head>
<frameset cols="*" rows="72,*" border="0" framespacing="0" frameborder="NO">
  <frame src=formquery.asp?fieldname=<%=fieldname%>&dummy=< %=dummyname%>&tbl_name=<%=tabelnaam%>" name="zoek" scrolling="NO" marginwidth="0" marginheight="0" frameborder="NO" name="query">
  <frame src="formfillerresult.asp?fieldname=<%=fieldname%> &dummy=<%=dummyname%>&tbl_name=<%=tabelnaam%>" name="result" scrolling="yes" marginwidth="0" marginheight="0" frameborder="NO">
</frameset>


</noframes>
</html>

[/code]

[code formquery.asp]


<%
fieldname = Request.QueryString("fieldname")
dummyname = Request.QueryString("dummy")
tabelnaam = Request.QueryString("tbl_name")
loopcount = 1


%>
<HTML>
<HEAD>




<link rel="stylesheet" href="/css/stylesheet.css" type="text/css">
</HEAD>
<title>Boot Translations CRM -> Selecteer Pagina</title>
<BODY>
<table width="799" border="0" bgcolor="white" cellpadding="0" cellspacing="2">
 <form name="query" action="formfillerresult.asp?fieldname=<%=fieldnam e%>&dummy=<%=dummy%>&tbl_name=<%=tabelnaam%>&searc h=yes" method="post" enctype="multipart/form-data" target="result" >
 <tr>
  <td colspan="4" class="header2">Zoek</td>
  </tr>
 <tr>
   <td width="160" class="content">naam</td>
   <td width="153" ><input type="text" name="naam" ></td>
   <td width="164" class="content">crediteur/debiteur nummer</td>
   <td width="312" ><input type="text" name="nummer"></td>
 </tr>
 <%
 if tabelnaam = "Tbl_vertaler" then
 %>
 <tr>
   <td class="content">taal</td>
   <td><%
   valuebox = VbCrLf & " <select size=""1"" name=""taal"">" & vbCrLf
    Set RS3 = Con.Execute("SELECT * FROM Tbl_taal ORDER by id ASC")
    do while not RS3.eof
     valuebox = valuebox & " <option value=""" & RS3("id") & """"
      if Request.form("taal") = Cint(RS3("id")) then
       valuebox = valuebox & "selected > " & RS3("taal_naam") & ", " & RS3("taal_afkorting") & "</option>"
      end if
      valuebox = valuebox & "> " & RS3("taal_naam") & ", " & RS3("taal_afkorting") & "</option>" & vbCrLf
      RS3.MoveNext
     loop
     valuebox = valuebox & vbCrLf
     valuebox = valuebox &"</select>"
     set RS3 = nothing
     Response.Write(valuebox)
     %></td>
   <td class="content">specialisatie</td>
   <td>
   <%
      valuebox = VbCrLf & " <select size=""1"" name=""spec"">" & vbCrLf
      Set RS2 = Con.Execute("SELECT id,Specialisaties FROM Tbl_Specialisaties ORDER by id ASC")
      do while not RS2.eof
        valuebox = valuebox & " <option value=""" & RS2("id") & """"
        if Request.Form("spec") = RS2("id") then
          valuebox = valuebox & " selected "
        end if
        valuebox = valuebox & "> "& RS2("Specialisaties") & "</option>" & vbCrLf
        RS2.MoveNext
        loop
        valuebox = valuebox & vbCrLf
        valuebox = valuebox &"</select>"
        set RS2 = nothing
        Response.Write(valuebox)
     %>
  </td>
 </tr>
 <%
 end if
 %>
 <tr>
   <td colspan="4"><INPUT TYPE="submit" VALUE="submit" action="submit"><img src="gfx/loepje.jpg" alt="Klik om te zoeken" width="20" height="19" onClick="'form.submit();'"></td>
 </tr>
  <tr>
   <td colspan="4"></td>
 </tr>
 <%
  for each item in Request.QueryString
   %>
   <tr>
    <td>
    <input type="text" value="Tbl_vertaler" name="Tbl_name">
    </td>
   </tr>
   <%
  next
 %>
</form>
</table>
</BODY>
</HTML>

[/code]

[code formfillerresult.asp]


<%
fieldname = Request.QueryString("fieldname")
dummyname = Request.QueryString("dummy")
tabelnaam = Request.QueryString("tbl_name")


loopcount = 1


Set RSselect = Con.execute("SELECT * FROM " & Tabelnaam)


SQL = "SELECT * FROM " & Tabelnaam

Set RSzoekarray = Server.CreateObject("ADODB.Recordset")
RSzoekarray.ActiveConnection = Con
RSzoekarray.Source = SQL
RSzoekarray.Open

%>
<HTML>
<HEAD>
<SCRIPT LANGUAGE="JavaScript">
<!--
function updateParent(id,naam) {
    top.opener.document.editform.<%=fieldname%>.value = id;
    top.opener.document.editform.<%=dummyname%>.value = naam;
    top.close();
    return false;
}

function color(id,color){
 var tabel = document.getElementById(id).style;
 var rows = document.getElementsByTagName('tr');
  tabel.background = color;
  tabel.cursor = 'hand';
}
-->
</SCRIPT>

<link rel="stylesheet" href="/css/stylesheet.css" type="text/css">
</HEAD>
<title>Boot Translations CRM -> Selecteer Pagina</title>
<BODY>

<table width="799" border="0" bgcolor="gray" cellpadding="0" cellspacing="0">
  <%
  do while not RSzoekarray.EOF
  %>
   <tr class="content" onclick="updateParent('<%=RSzoekarray("id")%>','<% =RSzoekarray("naam")%>');" onMouseOver="this.className='hover'" onMouseOut="this.className='content'">
   <%
    for each veld in Rszoekarray.Fields
   %>
     <TD ID="<%=loopcount%>"><%=veld.value%></TD>
   <%
    next
   %>
  </tr>
  <%
  RSzoekarray.MoveNext
  loopcount = loopcount + 1
  loop
  %>

</table>
</BODY>
</HTML>
<%
set RSzoekarray = nothing
set RSselect = nothing

%>

[/code ]

thanks very much !

 
Old December 17th, 2005, 06:20 AM
Registered User
 
Join Date: Dec 2005
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi guys,

thanks for all the help, finally figured it ou myself.
if somebody is interested in the source files, don't wast time and sent me a mail.



 
Old December 28th, 2005, 02:55 PM
Authorized User
 
Join Date: Nov 2005
Posts: 87
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to x_ray
Default

can you tell how you figured it out because i am facing the same problem

 
Old January 3rd, 2006, 02:57 PM
Registered User
 
Join Date: Dec 2005
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default

x_ray,

if you don't need to use any additional querystrings for the form you can use the get method in your form.
what i eventually did was a frameset with a 1 pixel high 2nd frame, and i used the top.open javacommand to get the values to the opener frame.
since it isn't reloading the complete frameset this will work just fine.

if you'd like the source code, let me know, i'll email them

good luck!

"They say if you play a Microsoft CD backwards, you hear satanic messages. Thats nothing, cause if you play it forwards, it installs Windows."





Similar Threads
Thread Thread Starter Forum Replies Last Post
How to set one frame src from other frame akumarp2p ASP.NET 1.x and 2.0 Application Design 2 March 13th, 2007 04:13 AM
refresh other form inside frame. (ASP.NET C#) richie86 ASP.NET 1.0 and 1.1 Basics 1 December 1st, 2005 02:18 PM
Call right frame Page_Load event from left frame. ochanarachel Classic ASP Basics 0 January 28th, 2005 05:13 AM
Refresh a frame from another frame czambran Javascript 3 October 21st, 2004 11:20 AM
Passing form values from 1 frame to another. edkeyte Javascript How-To 4 February 2nd, 2004 12:33 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.