OutFront Forums
     Home    Register     Search      Help      Login    

Sponsors
Frontpage website templates
Creative Website Templates for FrontPage, Dreamweaver, Flash, SwishMax
Shopping Cart Software
Ecommerce software integrated into Frontpage, Dreamweaver and Golive templates. No monthly fees and available in ASP and PHP versions.
Website Templates
We also have a wide selection of Dreamweaver, Expression Web and Frontpage templates as well as webmaster tools and CSS layouts.

Follow Us
On Facebook
On Twitter
RSS
Via Email

Recent Posts
Todays Posts
Most Active posts
Posts since last visit
My Recent Posts
Mark posts read

 

Passing one DB checkbox to the parent page

 
View related threads: (in this forum | in all forums)

Logged in as: Guest
Users viewing this topic: none
Printable Version 

All Forums >> Web Development >> ASP, PHP, and Database >> Passing one DB checkbox to the parent page
Page: [1]
 
 
sourkrouse

 

Posts: 32
Joined: 10/13/2007
Status: offline

 
Passing one DB checkbox to the parent page - 10/13/2007 9:45:11   
Hello, new subscriber, longtime user.

I have a form that when clicking a certain radio button a popup page opens called Branch Lookup. From there you can search your branch, when one is located click the checkbox next to it and it will send it back to the parent page. THe problem is when you are searching by city because multiple branches will appear. When that happens, only the first checkbox sends the name of the branch to the parent form. The rest return as 'undefined'. I need to come up with a solution to have the form recognise only the checkbox checked and send that variable to the parent form. Any help is appreciated!

In a nutshell, it works fine when there is only one result but when there is multiple results it doesn't realize it should send only the checked box.

Here is my code:
<html>

<head>
<script language="JavaScript"><!--
function setForm() {
    opener.document.FrontPage_Form1.BRN_NM.value = document.inputForm1.BranchName.value;

   
    self.close();
    return false;
}
//--></script>
<script language="JavaScript"><!--
maxBoxes = 1;
boxesChecked = 0;
function checkIt(theBox) {
   if (boxesChecked+1 > maxBoxes) {
      alert('Select Only One Branch');
      return false;
   }
   boxesChecked++
   return true;
} 
//--></script>

</head>

<body>

<form BOTID="0" METHOD="POST">
	<input type="hidden" name="fpdbr_0_PagingMove" value="  |<  ">
	<table BORDER="0">
		<tr>
			<td><b>BranchName</b></td>
			<td>
			<input TYPE="TEXT" NAME="BranchName" VALUE="<%=Server.HtmlEncode(Request("BranchName"))%>"></td>
		</tr>
		<tr>
			<td><b>City</b></td>
			<td>
			<input TYPE="TEXT" NAME="City" VALUE="<%=Server.HtmlEncode(Request("City"))%>"></td>
		</tr>
	</table>
	<br>
	<input TYPE="Submit"><input TYPE="Reset"><p> </p>
</form>

<form method="POST" name="inputForm1" onSubmit="return setForm();">
	
		<!--#include file="../../../_fpclass/fpdblib.inc"-->

<% if 0 then %>
<SCRIPT Language="JavaScript">
document.write("<div style='background: yellow; color: black;'>The Database Results component on this page is unable to display database content. The page must have a filename ending in '.asp', and the web must be hosted on a server that supports Active Server Pages.</div>");
</SCRIPT>
<% end if %>
<%
fp_sQry="SELECT * FROM Table_Name WHERE (BranchName LIKE '%::BranchName::%' OR City LIKE '%::City::%') ORDER BY BranchName ASC"
fp_sDefault="BranchName=Null&City=Null"
fp_sNoRecords="<tr><td colspan=9 align=""LEFT"" width=""100%"">Search Above.</td></tr>"
fp_sDataConn="NAMEREMOVEDFORSECURITY"
fp_iMaxRecords=256
fp_iCommandType=1
fp_iPageSize=0
fp_fTableFormat=True
fp_fMenuFormat=False
fp_sMenuChoice="BranchName"
fp_sMenuValue="BranchName"
fp_sColTypes="&RecordID=3&ManagerID=3&BranchName=129&Street1=201&Street2=201&City=201&State=201&Zip=201&ZipMail=201&Type=201&PhoneOut=201&PhoneFax=201&OpenHours1=201&OpenHours2=201&OpenHours3=201&OpenHours4=201&OpenHours5=201&OpenHours6=201&WalkUpHours1=201&WalkUpHours2=201&WalkUpHours3=201&WalkUpHours4=201&WalkUpHours5=201&WalkUpHours6=201&ContactTitle1=201&ContactTitle2=201&ContactTitle3=201&MailCode=201&Bank=201&PhoneNetwork1=201&PhoneNetwork2=201&Landmark1=201&Landmark2=201&OpenHoursDriveUp1=201&OpenHoursDriveUp2=201&OpenHoursDriveUp3=201&OpenHoursDriveUp4=201&OpenHoursDriveUp5=201&OpenHoursDriveUp6=201&Market=201&Comment1=201&Comment2=201&RU=201&ContactName1=201&ContactName2=201&ContactName3=201&Region=201&OwningRu=201&LastCsr=201&LastUpdated=135&Status=201&Services=201&CostCenter=201&SaftyDepBox=201&Directions=201&TransactionCO=201&"
fp_iDisplayCols=9
fp_fCustomQuery=False
BOTID=0
fp_iRegion=BOTID
%>
<!--#include file="../../../_fpclass/fpdbrgn1.inc"-->
<table width="100%">
<tr>
			<td rowspan="3" width="22">
			<input type="Checkbox" name="BranchName" value="<%=FP_FIELD(fp_rs,"BranchName")%>"></td>
			<td>
			</td>
			
		</tr>
<tr>
			<td>
			<b><font face="Arial" size="2">
			<%=FP_FieldVal(fp_rs,"BranchName")%></font></b><p><font face="Arial" size="2"> <%=FP_FieldVal(fp_rs,"Region")%>
			</font>
			</p>
		
			</td>
			
		</tr>
		<tr>
			<td>
			<font face="Arial" size="1" color="#800000"><%=FP_FieldVal(fp_rs,"Street1")%><%=FP_FieldVal(fp_rs,"Street2")%>, <%=FP_FieldVal(fp_rs,"City")%>, <%=FP_FieldVal(fp_rs,"State")%> <%=FP_FieldVal(fp_rs,"Zip")%>
			</font></td>
		</tr></table>
		<!--#include file="../../../_fpclass/fpdbrgn2.inc"--><input type="submit" value="Add Branch"></form>



</body>

</html>


< Message edited by rdouglass -- 10/13/2007 14:55:47 >
William Lee

 

Posts: 1273
Joined: 1/25/2002
From: Singapore
Status: offline

 
RE: Passing one DB checkbox to the parent page - 10/13/2007 12:04:17   
Can you edit your post so that we don't have to scroll so much to the right to read your problem?:)

_____________________________

William Lee

pǝssǝɟoɹd-ɟ1ǝs ʎɥʇɹoʍʇsnɹʇ ʇsoɯ ɹnoʎ
nɹnb ǝsɐqɐʇɐp & dsɐ ,ʍɹp ,ǝbɐdʇuoɹɟ





(in reply to sourkrouse)
rdouglass

 

Posts: 9280
From: Biddeford, ME USA
Status: offline

 
RE: Passing one DB checkbox to the parent page - 10/13/2007 15:19:13   
quote:

opener.document.FrontPage_Form1.BRN_NM.value = document.inputForm1.BranchName.value;


It's obviously that it supposed to be passed right there. Have you tried just sticking an alert right there to confirm what is being passed?

alert(document.inputForm1.BranchName.value);

Also, have you tried using document.getElementByID('BranchName').value at all?

_____________________________

Don't take you're eye off your final destination.

ASP Checkbox Function Tutorial.

(in reply to William Lee)
sourkrouse

 

Posts: 32
Joined: 10/13/2007
Status: offline

 
RE: Passing one DB checkbox to the parent page - 10/13/2007 21:49:44   
Thank you. I tried this:

<script language="JavaScript"><!--
function setForm() {
    opener.document.FrontPage_Form1.BRN_NM.value = document.getElementByID('Branch').value;
  {alert(document.inputForm1.Branch.value);
}
    self.close();
    return false;

}

//--></script>



I changed the name of my check box to just Branch because my search box was also named BranchName. When I tested this, it only clears the form (however when the checkbox was named BranchName as in my original code, it posted the Branch Name to the search box at the top of the form and submitted that query so that it cleared the rest of the database results leaving only the one selected but ended there).

I tried an alert and it didn't give me anything different. When there is only one result I get the name of the branch but when there are multiple results, I get 'undefined'.

It's like it's trying to pull all the branch names of all the records that result but it can't pass that many to the parent form so it just says 'undefined'. I need it to pass only the one that is checked.

Thanks for all your help and I will try to post "prettier" submissions. :)

(in reply to rdouglass)
BeTheBall

 

Posts: 6502
Joined: 6/21/2002
From: West Point Utah USA
Status: offline

 
RE: Passing one DB checkbox to the parent page - 10/14/2007 18:38:26   
When there is more than one result, your form generates more than one checkbox named "Branch". That is why both your function and the alert fail. The code has no idea which checkbox named "Branch" you are referring to.

If only one can be checked, I would suggest you change from checkboxes to radio buttons. Radio buttons are the more proper component when you are asking a user to select only one choice.

_____________________________

Duane

Some people are like Slinkies . . . Not really good for anything . . . . . But they still bring a smile to your face when you push them down a flight of stairs.

(in reply to sourkrouse)
sourkrouse

 

Posts: 32
Joined: 10/13/2007
Status: offline

 
RE: Passing one DB checkbox to the parent page - 10/15/2007 7:18:07   
Thanks but I also tried that and forgot to mention it. I get the same result. (Sorry about that). I also tried the following script to be sure only one box was checked:
<script language="JavaScript"><!--
maxBoxes = 1;
boxesChecked = 0;
function checkIt(theBox) {
   if (boxesChecked+1 > maxBoxes) {
      alert('Select Only One Branch');
      return false;
   }
   boxesChecked++
   return true;
} 
//--></script>


I think your right that it doesn't know which chekbox named branch to look for. But if it's a radio button, that should be treated as a group so that shouldn't be problem. It's got to be something with the name, i just can't figure it out. Thanks for all your help.

(in reply to BeTheBall)
rdouglass

 

Posts: 9280
From: Biddeford, ME USA
Status: offline

 
RE: Passing one DB checkbox to the parent page - 10/15/2007 8:26:46   
quote:

<script language="JavaScript"><!--
function setForm() {
opener.document.FrontPage_Form1.BRN_NM.value = document.getElementByID('Branch').value;
{alert(document.inputForm1.Branch.value);
}
self.close();
return false;

}

//--></script>


Try this way:


<script language="JavaScript"><!--
function setForm() {



var tempStr = "";
for( j=0 ; j<len ; j++) {
if (document.inputForm1.elements[j].name.substring(0,10)=='BranchName') && (document.inputForm1.elements[j].checked==1){
tempStr = tempStr + document.inputForm1.elements[j].value;
}



opener.document.FrontPage_Form1.BRN_NM.value = tempStr;


self.close();
return false;

}

//--></script>

What does that pass? That any better?

_____________________________

Don't take you're eye off your final destination.

ASP Checkbox Function Tutorial.

(in reply to sourkrouse)
sourkrouse

 

Posts: 32
Joined: 10/13/2007
Status: offline

 
RE: Passing one DB checkbox to the parent page - 10/15/2007 13:52:10   
Nope, that didn't pass anything, it just cleared the form.

I then tried creating a seperate form, pass the value and then submit it from there but that just cleared the form also. Any other ideas? It doesn't have to be a checkbox, it could be a link but I can't get that to work either.

It doens't seem like the function even runs because the alert doesn't popup.

Here's my current code since I made so many modifications, plus I changed some names around since there are so many forms.:
<html>

<head>
<script language="JavaScript"><!--
function setForm() {

var tempStr = ""; 
for( j=0 ; j<len ; j++) { 
if (document.inputForm3.elements[j].name.substring(0,10)=='Branch') && (document.inputForm3.elements[j].checked==1){ 
tempStr = tempStr + document.inputForm3.elements[j].value; 
} 


    opener.document.FrontPage_Form1.BRN_NM.value = tempStr;
  {alert(document.inputForm3.Branch.value);
}
    self.close();
    return false;

}

//--></script>
<script language="JavaScript"><!--
function setForm1() {

opener.document.FrontPage_Form1.BRN_NM.value = document.inputForm2.NO.value;
   
    self.close();
    return false;
}
//--></script>

<script language="JavaScript"><!--
maxBoxes = 1;
boxesChecked = 0;
function checkIt(theBox) {
   if (boxesChecked+1 > maxBoxes) {
      alert('Select Only One Branch');
      return false;
   }
   boxesChecked++
   return true;
} 
//--></script>
<script language="JavaScript"><!--
function Submit() {
    document.form['inputForm1'].submit();
}
//--></script>
</head>

<body>

<form BOTID="0" METHOD="POST">
	<input type="hidden" name="fpdbr_0_PagingMove" value="  |<  ">
	<table BORDER="0">
		<tr>
			<td><b>BranchName</b></td>
			<td>
			<input TYPE="TEXT" NAME="[color=#FF0000]Name[/color]" VALUE="<%=Server.HtmlEncode(Request("BranchName"))%>"></td>
		</tr>
		<tr>
			<td><b>City</b></td>
			<td>
			<input TYPE="TEXT" NAME="City" VALUE="<%=Server.HtmlEncode(Request("City"))%>"></td>
		</tr>
	</table>
	<br>
	<input TYPE="Submit"><input TYPE="Reset"><p> </p>
	
</form>
<form name="inputForm2" onSubmit="return setForm1();">
<input type="hidden" name="NO" value="Do_Not_Know">
<input type="submit" value=">>Don't Know, Close Window<<" name="B1">
</form>
<form method="Post" name="inputForm1">
	
		<!--#include file="../../../_fpclass/fpdblib.inc"-->

<% if 0 then %>
<SCRIPT Language="JavaScript">
document.write("<div style='background: yellow; color: black;'>The Database Results component on this page is unable to display database content. The page must have a filename ending in '.asp', and the web must be hosted on a server that supports Active Server Pages.</div>");
</SCRIPT>
<% end if %>
<%
fp_sQry="SELECT * FROM TABLENAME WHERE (BranchName LIKE '%::Name::%' OR City LIKE '%::City::%') ORDER BY BranchName ASC"
fp_sDefault="BranchName=Null&City=Null"
fp_sNoRecords="<tr><td colspan=9 align=""LEFT"" width=""100%"">Search Above.</td></tr>"
fp_sDataConn="NAMEREMOVEDFORSECURITY"
fp_iMaxRecords=256
fp_iCommandType=1
fp_iPageSize=0
fp_fTableFormat=True
fp_fMenuFormat=False
fp_sMenuChoice="BranchName"
fp_sMenuValue="BranchName"
fp_sColTypes="&RecordID=3&ManagerID=3&BranchName=129&Street1=201&Street2=201&City=201&State=201&Zip=201&ZipMail=201&Type=201&PhoneOut=201&PhoneFax=201&OpenHours1=201&OpenHours2=201&OpenHours3=201&OpenHours4=201&OpenHours5=201&OpenHours6=201&WalkUpHours1=201&WalkUpHours2=201&WalkUpHours3=201&WalkUpHours4=201&WalkUpHours5=201&WalkUpHours6=201&ContactTitle1=201&ContactTitle2=201&ContactTitle3=201&MailCode=201&Bank=201&PhoneNetwork1=201&PhoneNetwork2=201&Landmark1=201&Landmark2=201&OpenHoursDriveUp1=201&OpenHoursDriveUp2=201&OpenHoursDriveUp3=201&OpenHoursDriveUp4=201&OpenHoursDriveUp5=201&OpenHoursDriveUp6=201&Market=201&Comment1=201&Comment2=201&RU=201&ContactName1=201&ContactName2=201&ContactName3=201&Region=201&OwningRu=201&LastCsr=201&LastUpdated=135&Status=201&Services=201&CostCenter=201&SaftyDepBox=201&Directions=201&TransactionCO=201&"
fp_iDisplayCols=9
fp_fCustomQuery=False
BOTID=0
fp_iRegion=BOTID
%>
<!--#include file="../../../_fpclass/fpdbrgn1.inc"-->
<table width="100%">
<tr>
			<td rowspan="3" width="22">

			<input type="checkbox" name="Branch" value="<%=FP_FIELD(fp_rs,"BranchName")%>" onChange="document.inputForm1.Branch.value = document.inputForm3.Branch.value"></td>
			<td>
			</td>
			
		</tr>
<tr>
			<td>
			<b><font face="Arial" size="2">
			<%=FP_FieldVal(fp_rs,"BranchName")%></font></b><p><font face="Arial" size="2"> <%=FP_FieldVal(fp_rs,"Region")%>
			</font>
			</p>
		
			</td>
			
		</tr>
		<tr>
			<td>
			<font face="Arial" size="1" color="#800000"><%=FP_FieldVal(fp_rs,"Street1")%><%=FP_FieldVal(fp_rs,"Street2")%>, <%=FP_FieldVal(fp_rs,"City")%>, <%=FP_FieldVal(fp_rs,"State")%> <%=FP_FieldVal(fp_rs,"Zip")%>
			</font></td>
		</tr></table>
		<!--#include file="../../../_fpclass/fpdbrgn2.inc"--></form>



<form method="POST" name="inputForm3" onsubmit="return setForm()">
	<p><input type="submit" value="Done" name="B2"></p>
	<input type="hidden" name="Branch" value="N/A">
</form>



</body>

</html>

(in reply to rdouglass)
sourkrouse

 

Posts: 32
Joined: 10/13/2007
Status: offline

 
RE: Passing one DB checkbox to the parent page - 10/15/2007 14:19:17   
Hey guys, I finally got it working. I went with my copy to a hidden field idea and that worked. Here is my final code. Probably the long way around but I do what I can. Thanks for all your help!!

<html>

<head>
<script language="JavaScript"><!--
function setForm() {




    opener.document.FrontPage_Form1.BRN_NM.value = document.inputForm1.Name.value;
  {alert(document.inputForm1.Name.value);
}
    self.close();
    return false;

}

//--></script>
<script language="JavaScript"><!--
function setForm1() {

opener.document.FrontPage_Form1.BRN_NM.value = document.inputForm2.NO.value;
   
    self.close();
    return false;
}
//--></script>

<script language="JavaScript"><!--
maxBoxes = 1;
boxesChecked = 0;
function checkIt(theBox) {
   if (boxesChecked+1 > maxBoxes) {
      alert('Select Only One Branch');
      return false;
   }
   boxesChecked++
   return true;
} 
//--></script>
<script language="JavaScript"><!--
function Submit() {
    document.form['inputForm1'].submit();
}
//--></script>
</head>

<body>

<form BOTID="0" METHOD="POST">
	<input type="hidden" name="fpdbr_0_PagingMove" value="  |<  ">
	<table BORDER="0">
		<tr>
			<td><b>BranchName</b></td>
			<td>
			<input TYPE="TEXT" NAME="Name" VALUE="<%=Server.HtmlEncode(Request("BranchName"))%>"></td>
		</tr>
		<tr>
			<td><b>City</b></td>
			<td>
			<input TYPE="TEXT" NAME="City" VALUE="<%=Server.HtmlEncode(Request("City"))%>"></td>
		</tr>
	</table>
	<br>
	<input TYPE="Submit"><input TYPE="Reset"><p> </p>
	
</form>
<form name="inputForm2" onSubmit="return setForm1();">
<input type="hidden" name="NO" value="Do_Not_Know">
<input type="submit" value=">>Don't Know, Close Window<<" name="B1">
</form>
<form method="Post" name="inputForm1" onsubmit="return setForm();">
	
		<!--#include file="../../../_fpclass/fpdblib.inc"-->

<% if 0 then %>
<SCRIPT Language="JavaScript">
document.write("<div style='background: yellow; color: black;'>The Database Results component on this page is unable to display database content. The page must have a filename ending in '.asp', and the web must be hosted on a server that supports Active Server Pages.</div>");
</SCRIPT>
<% end if %>
<%
fp_sQry="SELECT * FROM TABLENAME WHERE (BranchName LIKE '%::Name::%' OR City LIKE '%::City::%') ORDER BY BranchName ASC"
fp_sDefault="BranchName=Null&City=Null"
fp_sNoRecords="<tr><td colspan=9 align=""LEFT"" width=""100%"">Search Above.</td></tr>"
fp_sDataConn="NAMEREMOVEDFORSECURITY"
fp_iMaxRecords=256
fp_iCommandType=1
fp_iPageSize=0
fp_fTableFormat=True
fp_fMenuFormat=False
fp_sMenuChoice="BranchName"
fp_sMenuValue="BranchName"
fp_sColTypes="&RecordID=3&ManagerID=3&BranchName=129&Street1=201&Street2=201&City=201&State=201&Zip=201&ZipMail=201&Type=201&PhoneOut=201&PhoneFax=201&OpenHours1=201&OpenHours2=201&OpenHours3=201&OpenHours4=201&OpenHours5=201&OpenHours6=201&WalkUpHours1=201&WalkUpHours2=201&WalkUpHours3=201&WalkUpHours4=201&WalkUpHours5=201&WalkUpHours6=201&ContactTitle1=201&ContactTitle2=201&ContactTitle3=201&MailCode=201&Bank=201&PhoneNetwork1=201&PhoneNetwork2=201&Landmark1=201&Landmark2=201&OpenHoursDriveUp1=201&OpenHoursDriveUp2=201&OpenHoursDriveUp3=201&OpenHoursDriveUp4=201&OpenHoursDriveUp5=201&OpenHoursDriveUp6=201&Market=201&Comment1=201&Comment2=201&RU=201&ContactName1=201&ContactName2=201&ContactName3=201&Region=201&OwningRu=201&LastCsr=201&LastUpdated=135&Status=201&Services=201&CostCenter=201&SaftyDepBox=201&Directions=201&TransactionCO=201&"
fp_iDisplayCols=9
fp_fCustomQuery=False
BOTID=0
fp_iRegion=BOTID
%>
<!--#include file="../../../_fpclass/fpdbrgn1.inc"-->
<table width="100%">
<tr>
			<td rowspan="3" width="22">

			<input type="radio" name="Branch" value="<%=FP_FIELD(fp_rs,"BranchName")%>" onClick="cycleRadii(this.form)"></td>
			<td>
			</td>
			
		</tr>
<tr>
			<td>
			<b><font face="Arial" size="2">
			<%=FP_FieldVal(fp_rs,"BranchName")%></font></b><p><font face="Arial" size="2"> <%=FP_FieldVal(fp_rs,"Region")%>
			</font>
			</p>
		
			</td>
			
		</tr>
		<tr>
			<td>
			<font face="Arial" size="1" color="#800000"><%=FP_FieldVal(fp_rs,"Street1")%><%=FP_FieldVal(fp_rs,"Street2")%>, <%=FP_FieldVal(fp_rs,"City")%>, <%=FP_FieldVal(fp_rs,"State")%> <%=FP_FieldVal(fp_rs,"Zip")%>
			</font></td>
		</tr></table>
		<!--#include file="../../../_fpclass/fpdbrgn2.inc"--><input type="hidden" name="Name" value="N/A"><input type="submit" value="Done" name="B2"></form>

<SCRIPT LANGUAGE="JavaScript"><!--
function cycleRadii(what) {
    for (var i = 0; i<what.elements.length; i++) {
        if ((what.elements.name.indexOf('Branch') > -1)) {
            if (what.elements.checked) {
                what.Name.value = what.elements.value;
            }
        }
    }
}
//--></SCRIPT>





</body>

</html>

(in reply to sourkrouse)
sourkrouse

 

Posts: 32
Joined: 10/13/2007
Status: offline

 
RE: Passing one DB checkbox to the parent page - 10/19/2007 9:47:52   
Good Morning, I have a new problem with this.

I have a different 'Lookup' form (same concept) however on this form I want to pull more then just one value from database and post to to the original form. I tried my theory from above where I just copy the values into fields outside of the DRW so I can send only those fields. The problem is the same as before. When it returns one record it works fine, when it returns multiple records I get a value of 'undefined' in all my fields.
How to I get it to read the values and copy them to my fields outside the DRW so I can send them (when multiple records are returned)?

Here is my code:
<html>

<head>
<script language="JavaScript"><!--
function setForm() {




    opener.document.FrontPage_Form2.TXT_CTR_CODE.value = document.inputForm1.TXT_CTR_CODE.value;
    opener.document.FrontPage_Form2.AREA_NM.value = document.inputForm1.TXT_AREA1.value;
    opener.document.FrontPage_Form2.AREA_MNGE_Email_ADDR.value = document.inputForm1.AREA_MGR_EMAIL1.value;
    opener.document.FrontPage_Form2.AREA_MNGE_NM.value = document.inputForm1.AREA_MGR_NAME1.value;
    opener.document.FrontPage_Form2.BRN_MNGE_NM.value = document.inputForm1.TXT_EMAIL1.value;

    
  {alert(document.inputForm1.TXT_CTR_CODE.value);
}
    self.close();
    return false;

}

//--></script>
<script language="JavaScript"><!--
function CopyHidden() {


    this.form.TXT_AREA1.value=this.form.TXT_AREA.value;
    this.form.AREA_MGR_EMAIL1.value=this.form.AREA_MGR_EMAIL.value;
    this.form.AREA_MGR_NAME1.value=this.form.AREA_MGR_NAME.value;
    this.form.TXT_EMAIL1.value=this.form.TXT_EMAIL.value;

   
}

//--></script>
<script language="JavaScript"><!--
function setForm1() {

opener.document.FrontPage_Form1.BRN_NM.value = document.inputForm2.NO.value;
   
    self.close();
    return false;
}
//--></script>


<script language="JavaScript"><!--
function Submit() {
    document.form['inputForm1'].submit();
}
//--></script>
<script language="JavaScript"><!--
function copyData(from,to) { to.value = from.value; }
//--></script>

<title>Branch Manager Lookup</title>
</head>

<body>
<form name="inputForm2" onSubmit="return setForm1();">
<input type="hidden" name="NO" value="Do_Not_Know">
<p align="center"><u><b><font face="Arial"><span lang="en-us">Branch Manager Lookup</span></font></b></u></p>
<p align="center">
<input type="submit" value=">>Don't Know, Close Window<<" name="B1">
</p>
</form>
<form BOTID="0" METHOD="POST">
	<input type="hidden" name="fpdbr_0_PagingMove" value="  |<  ">
	<table BORDER="0">
		<tr>
			<td align="right" width="86"><b><font face="Arial" size="2">
			<span lang="en-us">Branch Name</span></font></b></td>
			<td>
			<input type="text" name="TXT_BRANCH" size="20" value="<%=Server.HtmlEncode(Request("TXT_BRANCH"))%>"></td>
			<td rowspan="2">
	<input TYPE="submit" value="Search"><input type="button" onClick="location.href='Branch_Mgr_Lookup.asp'" value="Start Over" name="B1"></td>
		</tr>
		<tr>
			<td align="right" width="86"><font face="Arial" size="2"><b>
			<span lang="en-us">Center Code</span></b></font></td>
			<td>
			<input NAME="CTR_CODE" VALUE="<%=Server.HtmlEncode(Request("TXT_CTR_CODE"))%>" size="15"></td>
		</tr>
		</table>
	
	
	<hr>
	
	
	
</form>
<form method="Post" name="inputForm1" onsubmit="return setForm();">
	
		<!--#include file="../../../_fpclass/fpdblib.inc"-->

<% if 0 then %>
<SCRIPT Language="JavaScript">
document.write("<div style='background: yellow; color: black;'>The Database Results component on this page is unable to display database content. The page must have a filename ending in '.asp', and the web must be hosted on a server that supports Active Server Pages.</div>");
</SCRIPT>
<% end if %>
<%
fp_sQry="SELECT * FROM ""Contacts"" WHERE (TXT_BRANCH LIKE '%::TXT_BRANCH::%' OR TXT_CTR_CODE LIKE '%::CTR_CODE::%') ORDER BY TXT_BRANCH ASC"
fp_sDefault="TXT_BRANCH=Null&TXT_CTR_CODE=Null&TXT_AREA=Null&AREA_MGR_EMAIL=Null&AREA_MGR_NAME=Null%TXT_EMAIL=Null"
fp_sNoRecords="<tr><td colspan=9 align=""LEFT"" width=""100%"">No records returned.</td></tr>"
fp_sDataConn="Contacts"
fp_iMaxRecords=256
fp_iCommandType=1
fp_iPageSize=0
fp_fTableFormat=True
fp_fMenuFormat=False
fp_sMenuChoice=""
fp_sMenuValue=""
fp_sColTypes="&TXT_CTR_CODE=5&TXT_BRANCH=200&TXT_AREA=200&TXT_MARKET=200&TXT_REGION=200&TXT_GROUP=200&TXT_POSITION_NAME=200&TXT_FIRST_NAME=200&TXT_LAST_NAME=200&TXT_VOICE_NUMBER=5&TXT_EMAIL=200&ADDRESS=200&CITY=200&STATE=200&ZIP=5&AREA_MGR_NAME=200&AREA_MGR_EMAIL=200&"
fp_iDisplayCols=9
fp_fCustomQuery=False
BOTID=0
fp_iRegion=BOTID
%>
<!--#include file="../../../_fpclass/fpdbrgn1.inc"-->
<table width="100%" style="border-bottom: 1px solid #808080">
<tr>
			<td rowspan="3" width="22">

			<input type="radio" name="TXT_CTR_CODE" value="<%=FP_FieldVal(fp_rs,"TXT_CTR_CODE")%>" onClick="cycleRadii(this.form)"></td>
			<td>
			</td>
			
		</tr>
<tr>
			<td>
			<b><font face="Arial" size="2">
			<%=FP_FieldVal(fp_rs,"TXT_BRANCH")%></font></b><font face="Arial" size="2"> <%=FP_FieldVal(fp_rs,"TXT_CTR_CODE")%>
			</font>
			</p>
		
			</td>
			
		</tr>
		<tr>
			<td>
			<font face="Arial" size="1" color="#800000"><%=FP_FieldVal(fp_rs,"City")%>, <%=FP_FieldVal(fp_rs,"State")%><%=FP_FieldVal(fp_rs,"Zip")%>
			</font></td>		
			<input type="hidden" name="TXT_AREA" value="<%=FP_FieldVal(fp_rs,"TXT_AREA")%>" onFocus="copyData(this,document.inputForm1.TXT_AREA1)">
		<input type="hidden" name="AREA_MGR_EMAIL" value="<%=FP_FieldVal(fp_rs,"AREA_MGR_EMAIL")%>" onFocus="copyData(this,document.inputForm1.AREA_MGR_EMAIL1)">
		<input type="hidden" name="AREA_MGR_NAME" value="<%=FP_FieldVal(fp_rs,"AREA_MGR_NAME")%>" onFocus="copyData(this,document.inputForm1.AREA_MGR_NAME1)">
		<input type="hidden" name="TXT_EMAIL" value="<%=FP_FieldVal(fp_rs,"TXT_EMAIL")%>" onFocus="copyData(this,document.inputForm1.TXT_EMAIL1)">
		</tr></table>		
		<!--#include file="../../../_fpclass/fpdbrgn2.inc"-->
<input type="hidden" name="TXT_AREA1" value="">
		<input type="hidden" name="AREA_MGR_EMAIL1" value="">
		<input type="hidden" name="AREA_MGR_NAME1" value="">
		<input type="hidden" name="TXT_EMAIL1" value="">
<input type="hidden" name="TXT_CTR_CODE1" value="">
		<input type="submit" value="Done" name="B2">
		</form>

<SCRIPT LANGUAGE="JavaScript"><!--
function cycleRadii(what) {
{
    for (var i = 0; i<what.elements.length; i++) {
        if ((what.elements.name.indexOf('TXT_CTR_CODE') > -1)) {
            if (what.elements.checked) {
                what.TXT_CTR_CODE1.value = what.elements.value;
            }
        }
    }

}
{


    what.TXT_AREA1.value=what.TXT_AREA.value;
    what.AREA_MGR_EMAIL1.value=what.AREA_MGR_EMAIL.value;
    what.AREA_MGR_NAME1.value=what.AREA_MGR_NAME.value;
    what.TXT_EMAIL1.value=what.TXT_EMAIL.value;

   
}
}

//--></SCRIPT>



Number of Records On this Page - <%=fp_iCount%>

</body>

</html>

(in reply to sourkrouse)
rdouglass

 

Posts: 9280
From: Biddeford, ME USA
Status: offline

 
RE: Passing one DB checkbox to the parent page - 10/19/2007 10:09:10   
Did you look at the JavaScript loop I posted above? That's how I grab stuff from checkboxes in JS. I use them quite often in forms and that worked virtually every time for me.

_____________________________

Don't take you're eye off your final destination.

ASP Checkbox Function Tutorial.

(in reply to sourkrouse)
sourkrouse

 

Posts: 32
Joined: 10/13/2007
Status: offline

 
RE: Passing one DB checkbox to the parent page - 10/19/2007 12:33:14   
Well I did on my previous form and it didn't work. The difference on this one is that I want to send more then one field back to the parent form.

This is what happens when one result is returned:

1. They click a button called PREFILL on the parent form.
2. A popup appears where they search for a branch.
3. They select the radio button next to the branch they want.
4. When they click done, the popup closes and 4 fields are prefilled with the column content based on the radio button selected.

I have an onClick for the radio:
<input type="radio" name="TXT_CTR_CODE" value="<%=FP_FieldVal(fp_rs,"TXT_CTR_CODE")%>" onClick="cycleRadii(this.form)">


Then I have 4 hidden fields inside the DRW and 5 outside the DRW (the 4 mentioned, plus a copy of the radio button):
<input type="hidden" name="TXT_AREA" value="<%=FP_FieldVal(fp_rs,"TXT_AREA")%>" >
		<input type="hidden" name="AREA_MGR_EMAIL" value="<%=FP_FieldVal(fp_rs,"AREA_MGR_EMAIL")%>" >
		<input type="hidden" name="AREA_MGR_NAME" value="<%=FP_FieldVal(fp_rs,"AREA_MGR_NAME")%>" >
		<input type="hidden" name="TXT_EMAIL" value="<%=FP_FieldVal(fp_rs,"TXT_EMAIL")%>" >
		</tr></table>		
		<!--#include file="../../../_fpclass/fpdbrgn2.inc"-->
<input type="hidden" name="TXT_AREA1" value="">
		<input type="hidden" name="AREA_MGR_EMAIL1" value="">
		<input type="hidden" name="AREA_MGR_NAME1" value="">
		<input type="hidden" name="TXT_EMAIL1" value="">
<input type="hidden" name="TXT_CTR_CODE1" value="">
		<input type="submit" value="Done" name="B2">
		</form>



The script copies everything from the fields inside the DRW to the fields outside the DRW:
<SCRIPT LANGUAGE="JavaScript"><!--
function cycleRadii(what) {
{
    for (var i = 0; i<what.elements.length; i++) {
        if ((what.elements.name.indexOf('TXT_CTR_CODE') > -1)) {
            if (what.elements.checked) {
                what.TXT_CTR_CODE1.value = what.elements.value;
            }
        }
    }

}
{


    what.TXT_AREA1.value=what.TXT_AREA.value;
    what.AREA_MGR_EMAIL1.value=what.AREA_MGR_EMAIL.value;
    what.AREA_MGR_NAME1.value=what.AREA_MGR_NAME.value;
    what.TXT_EMAIL1.value=what.TXT_EMAIL.value;

   
}
}

//--></SCRIPT>


And finally the script (called from OnSubmit) sends those 5 fields back to the parent form:
<script language="JavaScript"><!--
function setForm() {




    opener.document.FrontPage_Form2.TXT_CTR_CODE.value = document.inputForm1.TXT_CTR_CODE.value;
    opener.document.FrontPage_Form2.AREA_NM.value = document.inputForm1.TXT_AREA1.value;
    opener.document.FrontPage_Form2.AREA_MNGE_Email_ADDR.value = document.inputForm1.AREA_MGR_EMAIL1.value;
    opener.document.FrontPage_Form2.AREA_MNGE_NM.value = document.inputForm1.AREA_MGR_NAME1.value;
    opener.document.FrontPage_Form2.BRN_MNGE_NM.value = document.inputForm1.TXT_EMAIL1.value;

    
  {alert(document.inputForm1.TXT_CTR_CODE.value);
}
    self.close();
    return false;

}

//--></script>


I'm not sure how I could use the loop to make this happen. It doesn't have to be set up this way also. There could be just a link that sends it back? I just can't figure out why my method is not working. Thanks

(in reply to rdouglass)
rdouglass

 

Posts: 9280
From: Biddeford, ME USA
Status: offline

 
RE: Passing one DB checkbox to the parent page - 10/19/2007 14:30:12   
Would a URL be possible?

Or perhaps the full code of both pages? The parent and child windows perhaps?

_____________________________

Don't take you're eye off your final destination.

ASP Checkbox Function Tutorial.

(in reply to sourkrouse)
sourkrouse

 

Posts: 32
Joined: 10/13/2007
Status: offline

 
RE: Passing one DB checkbox to the parent page - 10/19/2007 15:05:02   
It's an internal site so I can't send a URL but here's the code for each.

Parent Form WLWC_AddTo_Record.asp (I'll bold the section that it's copying to, its at the bottom):
<html>

<head>
<script language="JavaScript" src="date-picker.js"></script>
</head>

<body>

<form method="POST" action="WLWC_Update_DRW.asp" name="FrontPage_Form2">

	<table border="0" width="100%" cellspacing="0" cellpadding="0" id="table1">
		
			
					<!--#include file="../../../_fpclass/fpdblib.inc"-->
<% if 0 then %>
<SCRIPT Language="JavaScript">
document.write("<div style='background: yellow; color: black;'>The Database Results component on this page is unable to display database content. The page must have a filename ending in '.asp', and the web must be hosted on a server that supports Active Server Pages.</div>");
</SCRIPT>
<% end if %>
<%
fp_sQry="SELECT * FROM T_WLWC WHERE (WLWC_ID =  ::WLWC_ID::)"
fp_sDefault=""
fp_sNoRecords="<tr><td colspan=44 align=""LEFT"" width=""100%"">No records returned.</td></tr>"
fp_sDataConn="STOLI"
fp_iMaxRecords=256
fp_iCommandType=1
fp_iPageSize=0
fp_fTableFormat=True
fp_fMenuFormat=False
fp_sMenuChoice=""
fp_sMenuValue=""
fp_sColTypes="&WLWC_ID=3&RECV_DT=135&RSL_DT=135&RSL_DY_CNT=3&UPDT_DT=135&UPDT_RACF_ID=200&CLOS_RACF_ID=200&SUBM_TY_NM=200&FDBCK_CAT_NM=200&FDBCK_SUB_CAT_NM=200&CMNT_TXT=200&REVWR_CMNT_TXT=200&RESPN_RSL_NM=200&MNGE_RESPN_FLG=129&ISS_CNTL_TXT=200&CNTL_FDBCK_TXT=200&ACCT_TY_NM=200&BRN_NM=200&CITY_NM=129&BRN_MNGE_NM=129&AREA_NM=129&AREA_MNGE_NM=129&AREA_MNGE_Email_ADDR=129&RGN_NM=129&GRP_NM=129&REP_FRST_NM=129&REP_LST_NM=129&SCND_REP_FRST_NM=129&SCND_REP_LST_NM=129&RFUND_ISS_FLG=129&RFUND_AMT=131&RFUND_RSN_TXT=200&ACCT_NBR=129&CLT_NM=129&CNTCT_ALLW_FLG=129&CLT_CNTCT_PHN_NBR=129&CALL_BK_RSN_DESC=129&SUBM_REP_Email_ADDR=129&CNTCT_CTR_NM=129&REP_MNGE_NM=129&NOTE_1_TXT=200&NOTE_2_TXT=200&NOTE_3_TXT=200&NOTE_4_TXT=200&"
fp_iDisplayCols=44
fp_fCustomQuery=False
BOTID=0
fp_iRegion=BOTID
%>
<!--#include file="../../../_fpclass/fpdbrgn1.inc"-->
<tr>
			<td colspan="2">
			<b><font face="Arial">
			<span lang="en-us">The following was submitted on:</b><font color="#800000"> <%=FP_FieldVal(fp_rs,"RECV_DT")%></font></span></font></td>
			<td> </td>
		</tr>
		<tr>
			<td colspan="2">
			<b><font face="Arial">
			<span lang="en-us">Representative RACF who submitted:</b><font color="#800000"> <%=FP_FieldVal(fp_rs,"REP_FRST_NM")%></font><font size="1"> (their 
			manager's RACF is <%=FP_FieldVal(fp_rs,"REP_MNGE_NM")%>)</font></span></font></td>
			<td> </td>
		</tr>
		<tr>
			<td colspan="2">
			<b><font face="Arial">
			<span lang="en-us">This Rep's STOLI Center:</b><font size="2" color="#800000"> <%=FP_FieldVal(fp_rs,"CNTCT_CTR_NM")%></font></span></font></td>
			<td> </td>
		</tr>
		<tr>
			<td>
			<table>

			</table>
			<input TYPE="HIDDEN" NAME="WLWC_ID" SIZE="40" VALUE="<%=FP_FieldHTML(fp_rs,"WLWC_ID")%>">
			<p> </td>
			<td>
			 </td>
			<td> </td>
		</tr>
		<tr>
			<td><span lang="en-us">Client Feedback Type:
			<%=FP_FieldVal(fp_rs,"FDBCK_CAT_NM")%></span></td>
			<td><span lang="en-us">Account Type:
			<input type="text" name="ACCT_TY_NM" size="20" value="<%=FP_FieldVal(fp_rs,"ACCT_TY_NM")%>"></span></td>
			<td> </td>
		</tr>
		<tr>
			<td> </td>
			<td><span lang="en-us">Account Number:
			<input type="text" name="ACCT_NBR" size="20" value="<%=FP_FieldVal(fp_rs,"ACCT_NBR")%>"></span></td>
			<td> </td>
		</tr>
		<tr>
			<td><span lang="en-us">Client Name:
			<input type="text" name="CLT_NM" size="20" value="<%=FP_FieldVal(fp_rs,"CLT_NM")%>"></span></td>
			<td><span lang="en-us">Client Contact Number:
			<input type="text" name="CLT_CNTCT_PHN_NBR" size="20" value="<%=FP_FieldVal(fp_rs,"CLT_CNTCT_PHN_NBR")%>">
			<br>
			Contact Allowed?:
			<input type="checkbox" name="CNTCT_ALLW_FLG" <% 
If FP_Field(fp_rs,"CNTCT_ALLW_FLG")="Y" Then 
Response.write "Checked" 
End If 
%> value="Y"></span></td>
			<td> </td>
		</tr>
		<tr>
			<td><span lang="en-us">Client Region/Market:
			<input type="text" name="RGN_NM" size="20" value="<%=FP_FieldVal(fp_rs,"RGN_NM")%>"></span></td>
			<td><span lang="en-us">Reason for Call Back:
			<input type="text" name="CALL_BK_RSN_DESC" size="20" value="<%=FP_FieldVal(fp_rs,"CALL_BK_RSN_DESC")%>"></span></td>
			<td> </td>
		</tr>
		<tr>
			<td colspan="2">
			<p style="margin-top: 0; margin-bottom: 0"><span lang="en-us">
			Comments:</span></p>
			<p style="margin-top: 0; margin-bottom: 0">
			<textarea rows="7" name="CMNT_TXT" cols="80"><%=FP_FieldVal(fp_rs,"CMNT_TXT")%></textarea></td>
			<td> </td>
		</tr>
		<tr>
			<td> </td>
			<td> </td>
			<td> </td>
		</tr>
	</table>
	<p><span lang="en-us">Rep Name: First
	<input type="text" name="SCND_REP_FRST_NM" size="20"> 
	Last
	<input type="text" name="SCND_REP_LST_NM" size="20"></span></p>
	<p><span lang="en-us">STOLI Group: 
	<select size="1" name="Group" onChange="document.FrontPage_Form2.GRP_NM.value = this.options[this.selectedIndex].value">
	<option value="Select One..." selected>Select One...</option>
	<option value="Business Care">Business Care</option>
	<option value="Customer Care">Customer Care</option>
	<option value="eServices">eServices</option>
	<option value="Fulfillment">Fulfillment</option>
	<option value="Inbound Sales">Inbound Sales</option>
	<option value="Other - Corporate">Other - Corporate Function
	</option>
	<option value="Specialty Care">Specialty Care</option>
	<option value="Specialty Sales">Specialty Sales</option>
	</select>
	<input type="text" name="GRP_NM" size="20" value="<%=FP_FieldVal(fp_rs,"GRP_NM")%>"></span></p>
	<p><span lang="en-us">Contact Type: 
	<select size="1" name="Type" onChange="document.FrontPage_Form2.SUBM_TY_NM.value = this.options[this.selectedIndex].value">
	<option selected>Select One...</option>
	<option value="Complaint">Complaint</option>
	<option value="Compliment">Compliment</option>
	<option value="Request for Info">Request for Info or Service
	</option>
	<option value="Suggestion">Suggestion</option>
	</select> 
	<input type="text" name="SUBM_TY_NM" size="20" value="<%=FP_FieldVal(fp_rs,"SUBM_TY_NM")%>"></span></p>
	<p><span lang="en-us">Client Feedback Category: 
	<select size="1" name="Feedback" onChange="document.FrontPage_Form2.FDBCK_CAT_NM.value = this.options[this.selectedIndex].value">
	<option selected>Select One...</option>
	<option value="Acct Open Process">Account Opening Process
	</option>
	<option value="App Submission">Application Submission</option>
	<option value="ATM/Branch Feedback">ATM/Branch Feedback</option>
	<option value="Fraud">Fraud
	</option>
	<option value="Hours of Operation">Hours of Operation</option>
	<option value="Inc/Incomp Disclosures Provided">Incorrect/Incomplete Disclosures Provided</option>
	<option value="Inc/Incomp Information Provided">Incorrect/Incomplete Information Provided</option>
	<option value="No Response to Email">No Response to Email</option>
	<option value="OCM/OB">OCM/OB - Online Cash Manager/Online Banking</option>
	<option value="Policy/Procedure Related">Policy/Procedure Related</option>
	<option value="Privacy Concerns">Privacy Concerns</option>
	<option value="Prod/Acct Change Not Requested">Product/Account Change Not Requested</option>
	<option value="Prod/Gen Feedback">Product/General Feedback</option>
	<option value="Qty of Service Provided">Quality of Service Provided</option>
	<option value="Refund Error">Refund Error</option>
	<option value="Request Not Comp">Request Not Completed</option>
	<option value="Statement Concerns">Statement Concerns</option>
	<option value="Technical">Technical</option>
	<option value="Voice Response Unit">Voice Response Unit</option>
	<option value="Wait Times">Wait Times</option>
	</select><input type="text" name="FDBCK_CAT_NM" size="20" value="<%=FP_FieldVal(fp_rs,"FDBCK_CAT_NM")%>"></span></p>
	<p><span lang="en-us">Issue/Sub Category: 
	<select size="1" name="Feedback_SUB" onChange="document.FrontPage_Form2.FDBCK_SUB_CAT_NM.value = this.options[this.selectedIndex].value">
	<option value="Select One...">Select One...</option>
	<option value="Account Upgrade/Downgrade">Account Upgrade/Downgrade</option>
	<option value="Bill Pay">Bill Pay
	</option>
	<option value="CD - New or Renewal">CD - New or Renewal</option>
	<option value="Check Card Ordered">Check Card Ordered</option>
	<option value="Credit Card Ordered">Credit Card Ordered</option>
	<option value="Money Market">Money Market</option>
	<option value="New Account Instead of Upgrade">New Account Instead of Upgrade
	</option>
	<option value="New Ckg/Sav Account Opened">New Ckg/Sav Account Opened
	</option>
	<option value="ODP">ODP</option>
	<option value="Other">Other</option>
	<option value="Promotional Offer">Promotional Offer</option>
	<option value="Signature Advantage Account">Signature Advantage Account
	</option>
	<option value="Smart Solutions Account">Smart Solutions Account</option>
	</select><input type="text" name="FDBCK_SUB_CAT_NM" size="20"></span></p>
	<p><span lang="en-us">Status: <select size="1" name="Status" onChange="document.FrontPage_Form2.RESPN_RSL_NM.value = this.options[this.selectedIndex].value">
	<option selected value="Select One...">Select One...</option>
	<option value="New">New</option>
	<option value="Updated">Updated</option>
	<option value="Resolved">Resolved</option>
	</select><input type="text" name="RESPN_RSL_NM" size="20" value="<%=FP_FieldVal(fp_rs,"RESPN_RSL_NM")%>"></span></p>
	<p><span lang="en-us">Updated By:
	<input type="text" name="UPDT_RACF_ID" size="20"> 
	on
	<input type="text" name="UPDT_DT" size="20" value="<%= FormatDateTime(Date, 0) %>"></span></p>
	<table border="0" width="100%" cellspacing="0" cellpadding="0" id="table3">
		<tr>
			<td><span lang="en-us">Last Updated on <%=FP_FieldVal(fp_rs,"UPDT_DT")%>,by <%=FP_FieldVal(fp_rs,"UPDT_RACF_ID")%></span></td>
		</tr>
	</table>
	<table border="0" width="100%" cellspacing="0" cellpadding="0" id="table2">
		<tr>
			<td colspan="2"><span lang="en-us">Resolution:  <%=FP_FieldVal(fp_rs,"RSL_DT")%> by,<%=FP_FieldVal(fp_rs,"CLOS_RACF_ID")%> </span>
			<p><span lang="en-us">Resolved On:
			<input type="text" name="RSL_DT" size="20" value="<%= FormatDateTime(Date, 0) %>"> </span>
			<a href="javascript:show_calendar('FrontPage_Form1.RSL_DT');" onmouseover="window.status='Date Picker';return true;" onmouseout="window.status='';return true;">
      <img src="../../STOLIHelp/Change_Request/show-calendar.gif" width=24 height=22 border=0 align="middle"></a><span lang="en-us"> 
			BY:
			<input type="text" name="CLOS_RACF_ID" size="20"> 
			# of Days:
			<input type="text" name="RSL_DY_CNT" size="20" value="0"></span></td>
		</tr>
		<tr>
			<td> </td>
			<td> </td>
		</tr>
		<tr>
			<td><span lang="en-us">Resolution Required?   NOT NAMED</span><p>
			<span lang="en-us">Manager Responded to:
			<input type="checkbox" name="MNGE_RESPN_FLG" <% 
If FP_Field(fp_rs,"MNGE_RESPN_FLG")="Y" Then 
Response.write "Checked" 
End If 
%> value="Y"></span></p>
			<p>
			<span lang="en-us">Resolution Comments:</span></p>
			<p><textarea rows="4" name="REVWR_CMNT_TXT" cols="41"></textarea></td>
			<td><span lang="en-us">Controllable Issue?
			<input type="checkbox" name="ISS_CNTL_TXT" <% 
If FP_Field(fp_rs,"ISS_CNTL_TXT")="Y" Then 
Response.write "Checked" 
End If 
%> value="Y"></span><p>
			<span lang="en-us">Control Comments:</span></p>
			<p><textarea rows="6" name="CNTL_FDBCK_TXT" cols="20"></textarea></td>
		</tr>
		<tr>
			<td colspan="2"><span lang="en-us">Refund?
			<input type="checkbox" name="RFUND_ISS_FLG" <% 
If FP_Field(fp_rs,"RFUND_ISS_FLG")="Y" Then 
Response.write "Checked" 
End If 
%> value="Y"> </span>
			<p><span lang="en-us">Amount:
			<input type="text" name="RFUND_AMT" size="20" value=".00">  
			Reason:
			<input type="text" name="RFUND_RSN_TXT" size="20"></span></p>
			<p> </td>
		</tr>
		<tr>
			<td> </td>
			<td> </td>
		</tr>
		<tr>
			<td colspan="2"><span lang="en-us">Branch: </span> 
        		<input type="button" value="Prefill" onClick="window.open('Branch_Mgr_Lookup.asp','','width=400,height=400,scrollbars=yes');" name="Branch" style="font-size: 8pt; font-family: Tahoma"></td>
		</tr>
		<tr>
			<td><span lang="en-us">Branch Name (If applicable):
			<input type="text" name="BRN_NM" size="20" value="<%=FP_FieldVal(fp_rs,"BRN_NM")%>"></span></td>
			<td><span lang="en-us">Area manager name:
			<input type="text" name="AREA_MNGE_NM" size="20"></span></td>
		</tr>
		<tr>
			<td><span lang="en-us">City Name:
			<input type="text" name="CITY_NM" size="20" value="<%=FP_FieldVal(fp_rs,"CITY_NM")%>"></span></td>
			<td><span lang="en-us">Area Name:
			<input type="text" name="AREA_NM" size="20"></span></td>
		</tr>
		<tr>
			<td><span lang="en-us">Brch Manager Name:
			<input type="text" name="BRN_MNGE_NM" size="20"></span></td>
			<td><span lang="en-us">AM Email:
			<input type="text" name="AREA_MNGE_Email_ADDR" size="20"></span></td>
		</tr>
		<tr>
			<td><input type="text" name="TXT_CTR_CODE" size="20"></td>
			<td> </td>
		</tr>
	</table>
	
	<p><input type="submit" value="Submit" name="B1"><input type="reset" value="Reset" name="B2"></p>
</form>
<!--#include file="../../../_fpclass/fpdbrgn2.inc"-->
</body>

</html>


Popup Branch_Mgr_Lookup.asp:
<html>

<head>
<script language="JavaScript"><!--
function setForm() {




    opener.document.FrontPage_Form2.TXT_CTR_CODE.value = document.inputForm1.TXT_CTR_CODE.value;
    opener.document.FrontPage_Form2.AREA_NM.value = document.inputForm1.TXT_AREA1.value;
    opener.document.FrontPage_Form2.AREA_MNGE_Email_ADDR.value = document.inputForm1.AREA_MGR_EMAIL1.value;
    opener.document.FrontPage_Form2.AREA_MNGE_NM.value = document.inputForm1.AREA_MGR_NAME1.value;
    opener.document.FrontPage_Form2.BRN_MNGE_NM.value = document.inputForm1.TXT_EMAIL1.value;

    
  {alert(document.inputForm1.TXT_CTR_CODE.value);
}
    self.close();
    return false;

}

//--></script>

<script language="JavaScript"><!--
function setForm1() {

opener.document.FrontPage_Form1.BRN_NM.value = document.inputForm2.NO.value;
   
    self.close();
    return false;
}
//--></script>



<script language="JavaScript"><!--
function copyData(from,to) { to.value = from.value; }
//--></script>

<title>Branch Manager Lookup</title>
</head>

<body>
<form name="inputForm2" onSubmit="return setForm1();">
<input type="hidden" name="NO" value="Do_Not_Know">
<p align="center"><u><b><font face="Arial"><span lang="en-us">Branch Manager Lookup</span></font></b></u></p>
<p align="center">
<input type="submit" value=">>Don't Know, Close Window<<" name="B1">
</p>
</form>
<form BOTID="0" METHOD="POST">
	<input type="hidden" name="fpdbr_0_PagingMove" value="  |<  ">
	<table BORDER="0">
		<tr>
			<td align="right" width="86"><b><font face="Arial" size="2">
			<span lang="en-us">Branch Name</span></font></b></td>
			<td>
			<input type="text" name="TXT_BRANCH" size="20" value="<%=Server.HtmlEncode(Request("TXT_BRANCH"))%>"></td>
			<td rowspan="2">
	<input TYPE="submit" value="Search"><input type="button" onClick="location.href='Branch_Mgr_Lookup.asp'" value="Start Over" name="B1"></td>
		</tr>
		<tr>
			<td align="right" width="86"><font face="Arial" size="2"><b>
			<span lang="en-us">Center Code</span></b></font></td>
			<td>
			<input NAME="CTR_CODE" VALUE="<%=Server.HtmlEncode(Request("TXT_CTR_CODE"))%>" size="15"></td>
		</tr>
		</table>
	
	
	<hr>
	
	
	
</form>
<form method="Post" name="inputForm1" onsubmit="return setForm();">
	
		<!--#include file="../../../_fpclass/fpdblib.inc"-->

<% if 0 then %>
<SCRIPT Language="JavaScript">
document.write("<div style='background: yellow; color: black;'>The Database Results component on this page is unable to display database content. The page must have a filename ending in '.asp', and the web must be hosted on a server that supports Active Server Pages.</div>");
</SCRIPT>
<% end if %>
<%
fp_sQry="SELECT * FROM ""Contacts"" WHERE (TXT_BRANCH LIKE '%::TXT_BRANCH::%' OR TXT_CTR_CODE LIKE '%::CTR_CODE::%') ORDER BY TXT_BRANCH ASC"
fp_sDefault="TXT_BRANCH=Null&TXT_CTR_CODE=Null&TXT_AREA=Null&AREA_MGR_EMAIL=Null&AREA_MGR_NAME=Null%TXT_EMAIL=Null"
fp_sNoRecords="<tr><td colspan=9 align=""LEFT"" width=""100%"">No records returned.</td></tr>"
fp_sDataConn="Contacts"
fp_iMaxRecords=256
fp_iCommandType=1
fp_iPageSize=0
fp_fTableFormat=True
fp_fMenuFormat=False
fp_sMenuChoice=""
fp_sMenuValue=""
fp_sColTypes="&TXT_CTR_CODE=5&TXT_BRANCH=200&TXT_AREA=200&TXT_MARKET=200&TXT_REGION=200&TXT_GROUP=200&TXT_POSITION_NAME=200&TXT_FIRST_NAME=200&TXT_LAST_NAME=200&TXT_VOICE_NUMBER=5&TXT_EMAIL=200&ADDRESS=200&CITY=200&STATE=200&ZIP=5&AREA_MGR_NAME=200&AREA_MGR_EMAIL=200&"
fp_iDisplayCols=9
fp_fCustomQuery=False
BOTID=0
fp_iRegion=BOTID
%>
<!--#include file="../../../_fpclass/fpdbrgn1.inc"-->
<table width="100%" style="border-bottom: 1px solid #808080">
<tr>
			<td rowspan="3" width="22">

			<input type="radio" name="TXT_CTR_CODE" value="<%=FP_FieldVal(fp_rs,"TXT_CTR_CODE")%>" onClick="cycleRadii(this.form)"></td>
			<td>
			</td>
			
		</tr>
<tr>
			<td>
			<b><font face="Arial" size="2">
			<%=FP_FieldVal(fp_rs,"TXT_BRANCH")%></font></b><font face="Arial" size="2"> <%=FP_FieldVal(fp_rs,"TXT_CTR_CODE")%>
			</font>
			</p>
		
			</td>
			
		</tr>
		<tr>
			<td>
			<font face="Arial" size="1" color="#800000"><%=FP_FieldVal(fp_rs,"City")%>, <%=FP_FieldVal(fp_rs,"State")%><%=FP_FieldVal(fp_rs,"Zip")%>
			</font></td>		
			<input type="hidden" name="TXT_AREA" value="<%=FP_FieldVal(fp_rs,"TXT_AREA")%>">
		<input type="hidden" name="AREA_MGR_EMAIL" value="<%=FP_FieldVal(fp_rs,"AREA_MGR_EMAIL")%>">
		<input type="hidden" name="AREA_MGR_NAME" value="<%=FP_FieldVal(fp_rs,"AREA_MGR_NAME")%>">		<input type="hidden" name="TXT_EMAIL" value="<%=FP_FieldVal(fp_rs,"TXT_EMAIL")%>">
		</tr></table>		
		<!--#include file="../../../_fpclass/fpdbrgn2.inc"-->
<input type="hidden" name="TXT_AREA1" value="">
		<input type="hidden" name="AREA_MGR_EMAIL1" value="">
		<input type="hidden" name="AREA_MGR_NAME1" value="">
		<input type="hidden" name="TXT_EMAIL1" value="">
<input type="hidden" name="TXT_CTR_CODE1" value="">
		<input type="submit" value="Done" name="B2">
		</form>

<SCRIPT LANGUAGE="JavaScript"><!--
function cycleRadii(what) {
{
    for (var i = 0; i<what.elements.length; i++) {
        if ((what.elements.name.indexOf('TXT_CTR_CODE') > -1)) {
            if (what.elements.checked) {
                what.TXT_CTR_CODE1.value = what.elements.value;
            }
        }
    }

}
{


    what.TXT_AREA1.value=what.TXT_AREA.value;
    what.AREA_MGR_EMAIL1.value=what.AREA_MGR_EMAIL.value;
    what.AREA_MGR_NAME1.value=what.AREA_MGR_NAME.value;
    what.TXT_EMAIL1.value=what.TXT_EMAIL.value;

   
}
}

//--></SCRIPT>



Number of Records On this Page - <%=fp_iCount%>

</body>

</html>

(in reply to rdouglass)
BeTheBall

 

Posts: 6502
Joined: 6/21/2002
From: West Point Utah USA
Status: offline

 
RE: Passing one DB checkbox to the parent page - 10/19/2007 23:33:04   
This is a completely different approach, but may work for you. I would put all five values you need into the value attribute of the radio button. I put a "|" in between values so we can then use a function to split the values into an array. So, the radio button you posted above would look like this:

<input type="radio" name="TXT_CTR_CODE" value="<%=FP_FieldVal(fp_rs,"TXT_CTR_CODE")%>|<%=FP_FieldVal(fp_rs,"TXT_AREA")%>|<%=FP_FieldVal(fp_rs,"AREA_MGR_EMAIL")%>|<%=FP_FieldVal(fp_rs,"AREA_MGR_NAME")%>|<%=FP_FieldVal(fp_rs,"TXT_EMAIL")%>"
 onClick="cycleRadii(this.form);passValues(this)">


You will also see I added a second function to the onclick event called passValues(this). The function would be as follows and should go in the head of the document:

function passValues(t) {
    var myArray = t.split("|");
    opener.document.FrontPage_Form2.TXT_CTR_CODE.value=myArray[0];
    opener.document.FrontPage_Form2.AREA_NM.value=myArray[1];
    opener.document.FrontPage_Form2.AREA_MNGE_Email_ADDR.value=myArray[2];
    opener.document.FrontPage_Form2.AREA_MNGE_NM.value=myArray[3];
    opener.document.FrontPage_Form2.BRN_MNGE_NM.value=myArray[4]
}


So, the idea is to go ahead and pass the values with the onclick event of the radio button instead of a form button. Just use the form button to close the popup.

I haven't thoroughly tested this, but in theory it should work. You can also get rid of all the hidden fields.

_____________________________

Duane

Some people are like Slinkies . . . Not really good for anything . . . . . But they still bring a smile to your face when you push them down a flight of stairs.

(in reply to sourkrouse)
sourkrouse

 

Posts: 32
Joined: 10/13/2007
Status: offline

 
RE: Passing one DB checkbox to the parent page - 10/20/2007 13:17:46   
This is a great idea in theory. Seems like an easier way but it doesn't work. I get an error message with this:

var myArray = t.split("|")

the error is "Object doesn't support this property or method".

Arrays are not my thing so I don't know what to do next.

(in reply to BeTheBall)
BeTheBall

 

Posts: 6502
Joined: 6/21/2002
From: West Point Utah USA
Status: offline

 
RE: Passing one DB checkbox to the parent page - 10/20/2007 14:37:06   
My bad. Try this:

function passValues(t) {
var myArray = t.value.split("|");
opener.document.FrontPage_Form2.TXT_CTR_CODE.value=myArray[0];
opener.document.FrontPage_Form2.AREA_NM.value=myArray[1];
opener.document.FrontPage_Form2.AREA_MNGE_Email_ADDR.value=myArray[2];
opener.document.FrontPage_Form2.AREA_MNGE_NM.value=myArray[3];
opener.document.FrontPage_Form2.BRN_MNGE_NM.value=myArray[4]
}

_____________________________

Duane

Some people are like Slinkies . . . Not really good for anything . . . . . But they still bring a smile to your face when you push them down a flight of stairs.

(in reply to sourkrouse)
sourkrouse

 

Posts: 32
Joined: 10/13/2007
Status: offline

 
RE: Passing one DB checkbox to the parent page - 10/22/2007 16:06:57   
That didn't work either. I got the same error message. Any other ideas?

(in reply to BeTheBall)
rdouglass

 

Posts: 9280
From: Biddeford, ME USA
Status: offline

 
RE: Passing one DB checkbox to the parent page - 10/22/2007 16:26:29   
quote:

Any other ideas?


Have you tried opening these pages in FireFox and taking a close look at the Error Console? I've fixed lots of JS problems that way. Like if I make a typo or forget a closing bracket on a function.

You may already have done that but it is a commonly overlooked troubleshooting aid.

_____________________________

Don't take you're eye off your final destination.

ASP Checkbox Function Tutorial.

(in reply to sourkrouse)
sourkrouse

 

Posts: 32
Joined: 10/13/2007
Status: offline

 
RE: Passing one DB checkbox to the parent page - 10/22/2007 16:47:11   
I'm on my work PC which has IE and Front Page 2003.

Is there anything that's typical MS I could use to Debug?

It probably is something mistyped. It's not like it hasn't happened before.

(in reply to rdouglass)
BeTheBall

 

Posts: 6502
Joined: 6/21/2002
From: West Point Utah USA
Status: offline

 
RE: Passing one DB checkbox to the parent page - 10/22/2007 18:31:08   
Let me see how you implemented what I posted. Can you post the code for the radio button. Also, open the popup page in IE. Do view source and then post what the radio button looks like in the source.

_____________________________

Duane

Some people are like Slinkies . . . Not really good for anything . . . . . But they still bring a smile to your face when you push them down a flight of stairs.

(in reply to sourkrouse)
sourkrouse

 

Posts: 32
Joined: 10/13/2007
Status: offline

 
RE: Passing one DB checkbox to the parent page - 10/23/2007 12:53:26   
You guys are the best! The code worked, I just forgot to change the onSubmit function name :). I knew it was something I was doing, i just had to put a fresh brain to it. It worked perfectly. Thank you for all your help. I'll be back soon with more problems!

(in reply to BeTheBall)
Page:   [1]

All Forums >> Web Development >> ASP, PHP, and Database >> Passing one DB checkbox to the parent page
Page: [1]
Jump to: 1





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts