Time:
Scotland: Fri, 8:48 pm Rhode Island: Fri, 3:48 pm Florida: Fri, 3:48 pm New Mexico: Fri, 1:48 pm California: Fri, 12:48 pm
Buy this Ad Space. 180px wide. Please get in touch with KH@ if you are interested and make an offer.
US$10 per year - Save $100s! The Fabulously Unfair WebX Auction Bar. For Ebay etc. Ro-Sham-Bo the opposition. Laugh like Eric Cartman when you win! CLICK HERE NOW!More information and sign-up.
WebXpertz Hosting. Custom fit from $5pm. PHP/MySQL You'll save money, we'll save money. Seems fair to me. Interested? If so Please PM me here and tell me what you need. Thanks!
|
For continued disscussion on this topic : popup - passing values
dfred 06-26-2001, 07:52 PM Here is the situation. I have a parent window that has red and a yellow radio buttons default to yellow. When I select the red one, a popup window is displayed. I then must check atleast one of the three checkboxes. When the checkbox is checked, text is dynamically populated into a text field to be edited. When the user is done on this page, the data needs to be submitted back to the parent page as a hidden field to be passed to an action page. I am using Cold Fusion and need to use JS here to figure out how to pass the variables from the child to the parent page. I can get the box to display and can click on the check boxes and the text populates the fields, but I cannot seem to get the data to pass from the child to the parent. Could somone please help me!!
DAN
Ken Tholke 06-26-2001, 08:37 PM Have you tried
parent.opener.document.form.myHiddenField.value=document.form.textfield.value ?
dfred 06-26-2001, 08:47 PM not sure where that code should go...on the popup page or the parent page? also with the code:
parent.opener.document.form.myHiddenField.value=document.form.textfield.value
is the first part before the = sign parent and after the = is popup page or what. I am real new to JS and still learning what is what.
Thanks for the idea so far but need more input.
DAN
Ken Tholke 06-26-2001, 08:51 PM You put it in the pop up.
You would use an event in the pop up to pass it back to the parent
dfred 06-26-2001, 09:02 PM here is what my code looks like for the popup page:
<title>Untitled</title>
<script language="JavaScript1.2" src="MBValidate.js" type="text/javascript">
<!--
receipt_new.opener.document.receipt.A900COLORTEXT.value=document.red_reason.A900COLORTEXT.value
//--></script>
</head>
<body>
<cfform method="POST" enablecab="Yes" name="red_reason">
<cf_embedfields>
<cfinclude template="/includes/colorandtext.cfm">
<!--- <input type="hidden" name="900COLORTEXT" value=900COLORTEXT> --->
<br>
<input type="Submit" value="Update" ONCLICK="javascript:window.close()">
</cfform>
I figured the it should go into the popup page. I have an event item for closing the window but that may not be what I need.
also what is needed on the parent page. I have in input field that is has a hidden attribute. Really simple questions so I hope you understand that I know very little about JS and may as some very trivial questions.
thanks for the help
DAN
Ken Tholke 06-26-2001, 09:39 PM A submit button is used for submitting a form to a server or to jump to a new location.
Try it this way by first adding the function inside the script tags in your pop up's head.
function passField(){
parent.opener.document.myHiddenField.value=document.forms[0].900COLORTEXT.value;
}
then change the button to type="button" and fire the event:
onClick=passField();setTimeout("close()",1000)
You don't really have to set a timeout for the window to close, but if the value being passed is quite lengthy, you don't want it getting cut off in mid stream. I have not done very much with cold fusion (in fact, I haven't done anything with cold fusion come to think of it) :) so there's no guarantee this will work, but it would work for any standard html form within a pop up.
dfred 06-26-2001, 09:57 PM Did not do anything...infact when I hit the Button, it does not close the popup and does not pass values. This seems a lot trickier than I thought.
Any other thoughts?
If not, thanks for the ideas.
DAN
Jesuisiosono 06-26-2001, 10:13 PM Hi,
I'm a little confused. Why "parent"? Are you using frames? If you have a simple popUp from an existing window, you should be starting the DOM with "opener"
Also, if you are using a "hiddenField", you need to specify the form's name.
function passField(){
opener.document.formName.myHiddenField.value=document.forms[0].900COLORTEXT.value;
}
if it is simply a variable, this should suffice:
function passField(){
opener.myVar.value=document.forms[0].900COLORTEXT.value;
}
Then again...I may just be confused :)
Ken Tholke 06-26-2001, 10:30 PM I think it stems back from when I was a child and the gypsies kidnapped me and made me do terrible things :rolleyes:
Actually it is a case of very leanient browsers that have permitted me to get away with it. Thank you for setting me straight. At least I found where I stuck my JS Bible, so I guess a second thank you is in order as well. The missing form name was just sloppiness on my part, a thousand apologies dfred. Jesuisiosono's answer is what I meant.
Ken Tholke 06-27-2001, 12:36 AM Aha! I knew I wasn't wrong!!!
(just kidding)
<FORM>
<INPUT type=button name=check onclick=alert(parent==self?true:false)>
</FORM>
That's how I picked up the habit. You are right though, it does appear to add confusion to the issue.
Jesuisiosono 06-27-2001, 01:54 AM OK Ken,
Now I'm totally confused. What you just posted -- " parent == self" is used for keeping people within the frames.
Meanwhile, dfred:
Is any of this helpful? If not, post some code/a url.
dfred 06-27-2001, 03:36 PM I have been using your ideas but still cannot get the form to sumbit/pass the values to the parent page. here is what I have on the popup/child page:
function passField(){
opener.document.receipt.YELCOLORCODE.value=document.red_reason.YELCOLORCODE.value;
opener.document.receipt.A900COLORCODE.value=document.red_reason.A900COLORCODE.value;
opener.document.receipt.A900COLORTEXT.value=document.red_reason.A900COLORTEXT.value;
opener.document.receipt.LLCCOLORCODE.value=document.red_reason.LLCCOLORCODE.value;
opener.document.receipt.LLCCOLORTEXT.value=document.red_reason.LLCCOLORTEXT.value;
opener.document.receipt.OTHCOLORCODE.value=document.red_reason.OTHCOLORCODE.value;
opener.document.receipt.OTHCOLORTEXT.value=document.red_reason.OTHCOLORTEXT.value;
opener.document.receipt.submit();
window.close();
return false;
}
<cfform method="POST" enablecab="Yes" name="red_reason" onSubmit="return passField()">
all the check boxes and text fields that are displayed in the popup
<input type="button" value="submit" onClick="passField()">
</cfform>
cannot seem to pass the values or close the window. I think I am very close but cannot get over the hump.
Thanks
DAN
dfred 06-27-2001, 08:23 PM I am very close to getting this right. The problem is that this popup window or the radio buttons that control the popup window are running through a loop to display them muptiple times depending on the number of items selected. This causes nothing to happen. I need to find a way to loop through the values that are on the popup page so when they are submitted to the parent page, they are seoperated thus the finishing touchees.
Thanks
Dan
dfred 06-28-2001, 02:53 PM Still looking for a little more help.
I am very close to getting this to work correctly. The problem now is that this popup window or the radio buttons that control the popup window are running through a loop to display them muptiple times depending on the number of items displayed on the parent screen. So the popup window can be used for more than one item on the page. the problem seems to be that the page sees the entries from the popup page as having the same field names so if the popup page is used for more than one item on the page, then the text field entries are not comma delimited or there is only one entry. I need something that realizes that each time the popup window is opened, a new item is related to the popup box.
Please help me!!!!!
Vincent Puglia 06-28-2001, 03:11 PM Hi Dan,
could you post your latest code or a url, so I can see what you've got? Thanks
Vinny
dfred 06-28-2001, 04:06 PM the following JS code is on the popup page. I left off the Cold Fusion code which
will be displayed in the popup page and needs to be passed to the other page.
This code is check boxes and text boxes that are autopopulated depending on
which checkbox is checked.
<script>
function passField(){
opener.document.receipt.YELCOLORCODE.value=document.red_reason.YELCOLORCODE.value;
opener.document.receipt.A900COLORCODE.value=document.red_reason.A900COLORCODE.value;
opener.document.receipt.A900COLORTEXT.value=document.red_reason.A900COLORTEXT.value;
opener.document.receipt.LLCCOLORCODE.value=document.red_reason.LLCCOLORCODE.value;
opener.document.receipt.LLCCOLORTEXT.value=document.red_reason.LLCCOLORTEXT.value;
opener.document.receipt.OTHCOLORCODE.value=document.red_reason.OTHCOLORCODE.value;
opener.document.receipt.OTHCOLORTEXT.value=document.red_reason.OTHCOLORTEXT.value;
//opener.document.receipt.submit();
window.close();
return false;
}
</script>
the following is excerts from the partent page.
<SCRIPT LANGUAGE="JavaScript">
<!--
<cfoutput>
var ID = 0
function NewWindow1()
{
msgWindow=window.open("red_reason_popup.cfm?ID=1","displayWindow","toolbar=no,width=450,height=280,directories=no,status=no,scrollbars=no,resize=no,menubar=no")
}
</cfoutput>
// -->
</SCRIPT>
<cfform name="receipt" action="receipt_action.cfm">
<cfoutput>
<input type="hidden" name="maj_asm_name" value="#form.maj_asm_name#">
<input type="hidden" name="maj_asm_part_nbr" value="#form.maj_asm_part_nbr#">
<input type="hidden" name="YELCOLORCODE" value="">
<input type="hidden" name="A900COLORTEXT" value="">
<input type="hidden" name="OTHCOLORTEXT" value="">
<input type="hidden" name="LLCCOLORTEXT" value="">
<input type="hidden" name="A900COLORCODE" value="">
<input type="hidden" name="LLCCOLORCODE" value="">
<input type="hidden" name="OTHCOLORCODE" value="">
</cfoutput>
<table>
<tr>
<th>Serial</th>
<th>ALT</th>
<th>H Gear</th>
<th>Op. Status</th>
</tr>
.......................
<cfset loopcounter = "1">
<!--- <cfloop list= "#form.MAJ_ASM_SERIAL_NBR#" index="i"> --->
<cfloop CONDITION="#loopcounter# LESS THAN OR EQUAL TO #form.weapon_count#">
<tr <cfif loopcounter mod 2 is 1 > bgcolor="lightblue" </cfif> >
<td>
<input type="text" name="maj_asm_serial_nbr" size="9" maxlength="9">
.......................
<td>
<cfoutput>
<input type="radio" name="comp_condition_#loopcounter#" value="R" onclick="NewWindow1();"> Red <br>
<input type="radio" name="comp_condition_#loopcounter#" value="Yellow" checked> Yellow
</cfoutput></td>
........................
<cfset loopcounter = loopcounter + 1>
</cfloop>
</cfform>
I left out a lot of the code on the parent page but wanted to show the JS code,
the loop, and the radio buttons that activate the JS code. I am using Cold Fusion
and using some JS. Hope this is not to confussing.
Thanks
dfred 06-28-2001, 07:36 PM Here is my popup page Cold Fusion and JS:
<cfquery name = "gen_red_reas_900_qn"
datasource="#session.dbase#" username="#session.uname#" password="#session.pword#">
select
gen_red_text RedText900
from gen_red_reasons
where red_reason_code = '900'
</cfquery>
<cfquery name = "gen_red_reas_oth_qn"
datasource="#session.dbase#" username="#session.uname#" password="#session.pword#">
select
gen_red_text RedTextOTH
from gen_red_reasons
where upper(red_reason_code) = 'OTH'
</cfquery>
<cfquery name = "gen_red_reas_llc_qn"
datasource="#session.dbase#" username="#session.uname#" password="#session.pword#">
select
gen_red_text RedTextLLC
from gen_red_reasons
where upper(red_reason_code) = 'LLC'
</cfquery>
<html>
<head>
<title>Untitled</title>
<script language="JavaScript1.2" src="MBValidate.js" type="text/javascript"></script>
<script>
function passField(){
opener.document.receipt.YELCOLORCODE.value=document.red_reason.YELCOLORCODE.value;
opener.document.receipt.A900COLORCODE.value=document.red_reason.A900COLORCODE.value;
opener.document.receipt.A900COLORTEXT.value=document.red_reason.A900COLORTEXT.value;
opener.document.receipt.LLCCOLORCODE.value=document.red_reason.LLCCOLORCODE.value;
opener.document.receipt.LLCCOLORTEXT.value=document.red_reason.LLCCOLORTEXT.value;
opener.document.receipt.OTHCOLORCODE.value=document.red_reason.OTHCOLORCODE.value;
opener.document.receipt.OTHCOLORTEXT.value=document.red_reason.OTHCOLORTEXT.value;
//opener.document.receipt.submit();
window.close();
return false;
}
</script>
</head>
<body>
<cfform action="receipt_new.cfm" method="POST" enablecab="Yes" name="red_reason" >
<cf_embedfields>
<cfparam name="form.YELCOLORCODE" default="">
<cfparam name="form.A900COLORCODE" default="">
<cfparam name="form.A900COLORTEXT" default="">
<cfparam name="form.LLCCOLORCODE" default="">
<cfparam name="form.LLCCOLORTEXT" default="">
<cfparam name="form.OTHCOLORCODE" default="">
<cfparam name="form.OTHCOLORTEXT" default="">
<table>
<tr VALIGN="TOP" <th><b>Operational Status (Color):</b></th></br>
<cfinput TYPE="CHECKBOX" VALUE="YELLOW" NAME="YELCOLORCODE" checked
onclick="validate_ColorCodeTextYEL(red_reason)"></cfinput>
<cfoutput>Yellow(Operational)</cfoutput>
</tr>
<tr>
<cfoutput query="gen_red_reas_900_qn">
<CFinput TYPE="CHECKBOX" VALUE="RED900" NAME="A900COLORCODE"
onclick="validate_ColorCodeText900(red_reason,'#RedText900#')"></CFINPUT>
</cfoutput>
<cfoutput>Red Alt 900</cfoutput>
<CFINPUT TYPE="TEXT" ALIGN="CENTER" MAXLENGTH="338" NAME="A900COLORTEXT" SIZE="35"></CFINPUT>
</tr>
<tr>
<cfoutput query="gen_red_reas_llc_qn">
<CFinput TYPE="CHECKBOX" VALUE="REDLLC" NAME="LLCCOLORCODE"
onclick="validate_ColorCodeTextLLC(red_reason,'#RedTextLLC#')"></CFINPUT>
</cfoutput>
<cfoutput>Red LLC Exchange</cfoutput>
<CFINPUT TYPE="TEXT" ALIGN="CENTER" MAXLENGTH="338" NAME="LLCCOLORTEXT" SIZE="35"></CFINPUT>
</tr>
<tr>
<cfoutput query="gen_red_reas_oth_qn">
<CFinput TYPE="CHECKBOX" VALUE="REDOTH" NAME="OTHCOLORCODE"
onclick="validate_ColorCodeTextOTH(red_reason,'#RedTextOTH#')"></CFINPUT>
</cfoutput>
<cfoutput>Red Other</cfoutput>
<CFINPUT TYPE="TEXT" ALIGN="CENTER" MAXLENGTH="338" NAME="OTHCOLORTEXT" SIZE="35"></CFINPUT>
<!--- </td> --->
</tr>
</table>
<!-- End Operational Rediness Color Codes ***************************** --->
<br>
<!--- --->
<input type="button" name="pop_submit" value="submit" onClick="passField()">
</cfform>
here is my parent page Cold Fusion and JS:
<title>Receipt Weapon</title>
<script language="JavaScript1.2" src="MBValidate.js" type="text/javascript"></script>
<SCRIPT LANGUAGE="JavaScript">
<!--
<cfoutput>
var ID = 0
function NewWindow1()
{
msgWindow=window.open("red_reason_popup.cfm?ID=1","displayWindow","toolbar=no,width=450,height=280,directories=no,status=no,scrollbars=no,resize=no,menubar=no")
}
</cfoutput>
// -->
</SCRIPT>
<link rel="stylesheet" href="../lib/d_style.css">
<cfquery name = "getLoc" DATASOURCE="#SESSION.DBASE#" username="#SESSION.uname#" PASSWORD="#SESSION.PWORD#">
Select l.location_name, l.loc_code
FROM locations l,
unit_infos u
WHERE l.loc_code = u.loc_Code and
u.primary_loc = 'T'
</cfquery>
<cfquery name="hgear_part_desig_qn"
datasource="#session.dbase#" username="#session.uname#" password="#session.pword#">
select
hgear_part_number,
hgear_desg
from hgears
order by hgear_part_number
</cfquery>
<cfquery name="hgear_part_desig2_qn"
datasource="#session.dbase#" username="#session.uname#" password="#session.pword#">
select
hgear_part_number part2,
hgear_desg desg2
from hgears
order by hgear_part_number
</cfquery>
<cfoutput>
<font color = "blue"><b>#getLoc.location_name#</b>
<b> - </b>
<!--- ---><b>Receipt Weapon </b></font>
</cfoutput>
<cfif #session.MBSuperUser# IS "T"><!--- If a superuser... --->
<font color = "silver"><b><i>Super-User Mode</i></b></font>
<cfelseif session.verify IS "yes">
<font color = "silver"><b><i>Verification Mode</i></b></font>
<cfelse>
<font color = "silver"><b><i>Initial Data Entry Mode</i></b></font>
</cfif>
<br>
Weapon Code: <cfoutput>#form.MAJ_ASM_NAME#</cfoutput>
Part Number: <cfoutput>#form.MAJ_ASM_PART_NBR#</cfoutput> 
<br><br>
</head>
<body>
<cfform name="receipt" action="receipt_action.cfm">
<cfoutput>
<input type="hidden" name="maj_asm_name" value="#form.maj_asm_name#">
<input type="hidden" name="maj_asm_part_nbr" value="#form.maj_asm_part_nbr#">
<input type="hidden" name="YELCOLORCODE" value="">
<input type="hidden" name="A900COLORTEXT" value="">
<input type="hidden" name="OTHCOLORTEXT" value="">
<input type="hidden" name="LLCCOLORTEXT" value="">
<input type="hidden" name="A900COLORCODE" value="">
<input type="hidden" name="LLCCOLORCODE" value="">
<input type="hidden" name="OTHCOLORCODE" value="">
</cfoutput>
<table>
<tr>
<th>Serial</th>
<th>ALT</th>
<th>H Gear</th>
<th>Op. Status</th>
</tr>
<!--- Putting together the numeric alts in a string for each alpha alt and putting them in a select list. --->
<cfquery name = "alt_codes_qn"
datasource="#session.dbase#" username="#session.uname#" password="#session.pword#">
select
alt_code
from alt_codes
where alt_code in (select distinct alt_code from alpha_numeric_alts)
order by 1
</cfquery>
<CFSET sNumericAltArray = ArrayNew(1)>
<CFSET sMyArray = ArrayNew(1)>
<CFSET sMyArrayAlpha = ArrayNew(1)>
<CFSET ArrayClear(sMyArray)>
<CFSET ArrayClear(sMyArrayAlpha)>
<CFLOOP query="alt_codes_qn">
<CFSET sNumAltTemp = alt_code >
<cfquery name = "alt_status_qn"
datasource = "site1"
maxrows = 500 dbtype="Oracle80"
username = "devalxdf0" password="dfredericks" >
select numeric_alt sNumAlt
from alpha_numeric_alts
where alt_code = <CFQUERYPARAM VALUE=#sNumAltTemp#
CFSQLType="CF_SQL_VARCHAR">
order by numeric_order
</cfquery>
<CFSET ArrayClear(sNumericAltArray)>
<!--- Create an array that holds the alpha alts to match up with the numerics --->
<CFSET tempAlpha = ArrayAppend(sMyArrayAlpha, #sNumAltTemp#) >
<CFLOOP query="alt_status_qn">
<CFSET temp = ArrayAppend(sNumericAltArray, #sNumAlt#) >
</CFLOOP>
<CFSET myList = ArrayToList(sNumericAltArray, ", ")>
<CFSET temp2 = ArrayAppend(sMyArray , myList)>
</CFLOOP>
<cfset loopcounter = "1">
<cfloop CONDITION="#loopcounter# LESS THAN OR EQUAL TO #form.weapon_count#">
<tr <cfif loopcounter mod 2 is 1 > bgcolor="lightblue" </cfif> >
<td>
<input type="text" name="maj_asm_serial_nbr" size="9" maxlength="9">
</td>
<td>
<select name="NumericAlts">
<option default=""></option>
<CFLOOP INDEX="loopcount" FROM="1" TO=#arraylen(sMyArray)#>
<!--- Set the value equall to the alpha alts and the list shows the numeric strings --->
<OPTION value=<CFOUTPUT>#sMyArrayAlpha[loopcount]#</CFOUTPUT>><CFOUTPUT>#sMyArray[loopcount]#</CFOUTPUT></option>
<!--- <OPTION value=<CFOUTPUT>'#sMyArray[loopcount]#'</CFOUTPUT>><CFOUTPUT>#sMyArray[loopcount]#</CFOUTPUT></option> --->
</CFLOOP>
</select>
</td>
<td>
<cfinclude template="/includes/hgear.cfm">
</td>
<td>
<cfoutput>
<input type="radio" name="comp_condition_#loopcounter#" value="R" onclick="NewWindow1();"> Red <br>
<input type="radio" name="comp_condition_#loopcounter#" value="Yellow" checked> Yellow
</cfoutput></td>
</tr>
<cfset loopcounter = loopcounter + 1>
</cfloop>
</td>
</tr>
<tr>
<td colspan=5>
<hr color="lightblue"
<tr>
<input type="Submit" value="Submit" name="LocSubmit">
</td>
</tr>
</table>
</cfform>
dfred 06-29-2001, 02:53 PM Just checking to see if anyone can help me. I saw a lot of people helping on popup windows so I hope some of you can help me now.
DAN
dfred 07-02-2001, 04:03 PM Still checking to see if anyone can help me.
Vincent Puglia 07-02-2001, 04:20 PM Hi Dan,
Sorry to have kept you waiting. Now I want to make sure I got everything straight.
You are trying to pass values back to a form ('receipt') in the opener? Exactly what occurs when you pass the fields?
Based on the code I see, it should work. So, the only thing I can think of offhand (I don't have my coldFusion book on hand) is that the cf tags are somehow inteferring with the way javascript is viewing the DOM (document object method).
<cfform name="receipt" action="receipt_action.cfm">
<cfoutput>
<input type="hidden" name="maj_asm_name" value="#form.maj_asm_name#">
....etc...
opener.document.receipt.YELCOLORCODE.value = document.red_reason.YELCOLORCODE.value;
In other words, it cannot see the "opener.document.receipt" because you declare it with a 'cfform" tag, and browsers are instructed to ignore things they don't recognize.
Which brings me to my suggestions:
1) create a global array variable to hold the fields in the opener:
var myFields = new Array();
2) pass the values to that array;
opener.myFields[0] = document.red_reason.maj_asm_name.value;
...
opener.myFields[x] = document.red_reason.YELCOLORCODE.value;
3) then either assign the array to your hidden fields or simply send the array.
Vinny
dfred 07-02-2001, 05:33 PM Here is the situation...
I can get the popup window to work for each item on the page. for example, if I have 5 different rows with 5 different values, the radio buttons will work for each row. I can select the red radio button and it will open up the popup window and I can do what I need to do in the popup window. The window will even close. the issue involves passing those values. it seems that only one set of values will be submitted from the receipt page to an action page. It almost seems that when I select a second red radio button which brings up a popup window and pass that data to the receipt page, that new data overrides what was passed from the first red radio button and popup window.
All the data for serial numbers, or dates, or other fields pass to the action page in a comma delimited list, i need the values from the popup windows (if there are more than one used) to either pass in a comma delimited list, or pass individually with a 1,2,ect. added to the end of the code and text names.
I hope that makes sence.
if there are more that one popup windows used on the page, I need all the individual values to be passed to the receipt page so then those individual values can be passed on to the action page.
Thanks for the help...I know we are all busy and cannot always help right away or at all.
DAN
Vincent Puglia 07-02-2001, 06:53 PM Hi Dan,
Now I'm really confused.
Are you trying to gather values from more than one popUp before sending the data? Did you try putting in alert()s to see what is being sent/kept/updated?
Vinny
dfred 07-02-2001, 07:41 PM Yes there could be more than one popup on the same page.
the page loops through and displays multiple selections. for each selection, there will be a red/yellow radio button pair.
example: I select 5 objects to be displayed on the parent page. any one, all or none can have a problem which would require using the popup window and the data displayed in the popup window.
If I out of those 5 objects, 2 are red which means I need the popup window to display data, then the data from both popup windows needs to be passed. it seems that I am only getting one popup windows data being passed.
checkout the screen shop I made if what the parent page looks like.
Sorry for confussing you but with what I am tring to do I get confussed often.
DAN
Vincent Puglia 07-02-2001, 09:14 PM Hi Dan,
I think it's getting a little clearer :)
This will alway overwrite the value in the opener:
opener....value = document...value;
because you are assigning the value on the right to the value on the left. What follows, however, will always append to the fieldValue on the left:
opener....value += document...value;
Now, the pitfalls are 2:
1) you must declare each and every left value to a blank:
document.receipt.fieldname.value = "";
This way you know what you start with.
2) You will need to delimit each popUp's values from the others
opener....value += (document...value + delimiter);
the 'delimiter' can be any unique character you want -- I generally use "|" (vertical bars) or "," (commas), dependent upon the situatation.
Hope this helps
Vinny
dfred 07-02-2001, 09:34 PM I decided to post my popup window code. If you look at the js code, I did what I thought you said in your last post. I may not have added the code right because now my popup window will not submit and close. I am not sure if I declared the value correctly.
I am glad you understand what I am trying to accomplish.
DAN
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<cfquery name = "gen_red_reas_900_qn"
datasource="#session.dbase#" username="#session.uname#" password="#session.pword#">
select
gen_red_text RedText900
from gen_red_reasons
where red_reason_code = '900'
</cfquery>
<cfquery name = "gen_red_reas_oth_qn"
datasource="#session.dbase#" username="#session.uname#" password="#session.pword#">
select
gen_red_text RedTextOTH
from gen_red_reasons
where upper(red_reason_code) = 'OTH'
</cfquery>
<cfquery name = "gen_red_reas_llc_qn"
datasource="#session.dbase#" username="#session.uname#" password="#session.pword#">
select
gen_red_text RedTextLLC
from gen_red_reasons
where upper(red_reason_code) = 'LLC'
</cfquery>
<html>
<head>
<title>Untitled</title>
<script language="JavaScript1.2" src="MBValidate.js" type="text/javascript"></script>
<script>
function passField(){
document.receipt.YELCOLORCODE.value="";
document.receipt.A900COLORCODE.value="";
document.receipt.A900COLORTEXT.value="";
document.receipt.LLCCOLORCODE.value="";
document.receipt.LLCCOLORTEXT.value="";
document.receipt.OTHCOLORCODE.value="";
document.receipt.OTHCOLORTEXT.value="";
opener.document.receipt.YELCOLORCODE.value+=(document.red_reason.YELCOLORCODE.value+",");
opener.document.receipt.A900COLORCODE.value+=(document.red_reason.A900COLORCODE.value+",");
opener.document.receipt.A900COLORTEXT.value+=(document.red_reason.A900COLORTEXT.value+",");
opener.document.receipt.LLCCOLORCODE.value+=(document.red_reason.LLCCOLORCODE.value+",");
opener.document.receipt.LLCCOLORTEXT.value+=(document.red_reason.LLCCOLORTEXT.value+",");
opener.document.receipt.OTHCOLORCODE.value+=(document.red_reason.OTHCOLORCODE.value+",");
opener.document.receipt.OTHCOLORTEXT.value+=(document.red_reason.OTHCOLORTEXT.value+",");
//opener.document.receipt.submit();
window.close();
return false;
}
</script>
</head>
<!--- --->
<body> <!---src="MBValidate.js" onSubmit="return passField()"--->
<cfform action="receipt_new.cfm" method="POST" enablecab="Yes" name="red_reason" >
<cf_embedfields>
<!--- <cfinclude template="/includes/colorandtext.cfm"> --->
<cfparam name="form.YELCOLORCODE" default="">
<cfparam name="form.A900COLORCODE" default="">
<cfparam name="form.A900COLORTEXT" default="">
<cfparam name="form.LLCCOLORCODE" default="">
<cfparam name="form.LLCCOLORTEXT" default="">
<cfparam name="form.OTHCOLORCODE" default="">
<cfparam name="form.OTHCOLORTEXT" default="">
<table>
<tr VALIGN="TOP" <th><b>Operational Status (Color):</b></th></br>
<cfinput TYPE="CHECKBOX" VALUE="YELLOW" NAME="YELCOLORCODE" checked
onclick="validate_ColorCodeTextYEL(red_reason)"></cfinput>
<cfoutput>Yellow(Operational)</cfoutput>
</tr>
<tr>
<cfoutput query="gen_red_reas_900_qn">
<CFinput TYPE="CHECKBOX" VALUE="RED900" NAME="A900COLORCODE"
onclick="validate_ColorCodeText900(red_reason,'#RedText900#')"></CFINPUT>
</cfoutput>
<cfoutput>Red Alt 900</cfoutput>
<CFINPUT TYPE="TEXT" ALIGN="CENTER" MAXLENGTH="338" NAME="A900COLORTEXT" SIZE="35"></CFINPUT>
</tr>
<tr>
<cfoutput query="gen_red_reas_llc_qn">
<CFinput TYPE="CHECKBOX" VALUE="REDLLC" NAME="LLCCOLORCODE"
onclick="validate_ColorCodeTextLLC(red_reason,'#RedTextLLC#')"></CFINPUT>
</cfoutput>
<cfoutput>Red LLC Exchange</cfoutput>
<CFINPUT TYPE="TEXT" ALIGN="CENTER" MAXLENGTH="338" NAME="LLCCOLORTEXT" SIZE="35"></CFINPUT>
</tr>
<tr>
<cfoutput query="gen_red_reas_oth_qn">
<CFinput TYPE="CHECKBOX" VALUE="REDOTH" NAME="OTHCOLORCODE"
onclick="validate_ColorCodeTextOTH(red_reason,'#RedTextOTH#')"></CFINPUT>
</cfoutput>
<cfoutput>Red Other</cfoutput>
<CFINPUT TYPE="TEXT" ALIGN="CENTER" MAXLENGTH="338" NAME="OTHCOLORTEXT" SIZE="35"></CFINPUT>
<!--- </td> --->
</tr>
</table>
<!-- End Operational Rediness Color Codes ***************************** --->
<br>
<!--- --->
<input type="button" name="pop_submit" value="submit" onClick="passField()">
</cfform>
<!--- ONCLICK="javascript:window.close()" --->
</body>
</html>
Vincent Puglia 07-02-2001, 09:47 PM Hi Dan,
You cannot do this within the passFields function:
document.receipt.YELCOLORCODE.value="";
in fact, it should be giving you an error because you shouldn't have a form named 'receipt' within the same document as the function.
When I posted that, what I meant was to make sure the fields within the receipt form were of a known value.
For simplicities sake, just kill those lines and run it. Also, within your parent/opener page insert the following code at the end of the page, just before the </body> tag.
<script language='javascript'>
<!--
alert(document.receipt.YELCOLORCODE.value);
alert(document.receipt.A900COLORCODE.value);
alert(document.receipt.A900COLORTEXT.value);
alert(document.receipt.LLCCOLORCODE.value);
alert(document.receipt.LLCCOLORTEXT.value);
alert(document.receipt.OTHCOLORCODE.value);
alert(document.receipt.OTHCOLORTEXT.value);
//
//-->
</script>
run it with only one popup and then with more than one.
Vinny
dfred 07-02-2001, 09:50 PM Just some more info to help you figure out what I am doing. When I deleted the declared values, I was able to close the window and submit the form. Here is what my debug shows as the submitted items. I am thinking there may have to be a loop stating if one is checked add if not then don't add. I am thinking that the actual info on the page may be effecting the outcome since each checkbox has a default value which may be causing problems. Let me know what you think.
DAN
A900COLORCODE=RED900,RED900,
A900COLORTEXT=,,
ADD_COMPS=
COMP_CONDITION_1=R
COMP_CONDITION_2=Yellow
COMP_CONDITION_3=R
COMP_CONDITION_4=Yellow
COMP_CONDITION_5=Yellow
DESIGNATOR=
DESIGNATOR2=
DESIGNATOR3=
FIELDNAMES=MAJ_ASM_NAME,MAJ_ASM_PART_NBR,YELCOLORCODE,A900COLORTEXT,OTHCOLORTEXT,LLCCOLORTEXT,A900CO LORCODE,LLCCOLORCODE,OTHCOLORCODE,MAJ_ASM_SERIAL_NBR,NUMERICALTS,HGEAR_PART_NUMBER,HGEAR_PART_NUMBER 2,HGEAR_PART_NUMBER3,DESIGNATOR,DESIGNATOR2,DESIGNATOR3,COMP_CONDITION_1,MAJ_ASM_SERIAL_NBR,NUMERICA LTS,HGEAR_PART_NUMBER,HGEAR_PART_NUMBER2,HGEAR_PART_NUMBER3,DESIGNATOR,DESIGNATOR2,DESIGNATOR3,COMP_ CONDITION_2,MAJ_ASM_SERIAL_NBR,NUMERICALTS,HGEAR_PART_NUMBER,HGEAR_PART_NUMBER2,HGEAR_PART_NUMBER3,D ESIGNATOR,DESIGNATOR2,DESIGNATOR3,COMP_CONDITION_3,MAJ_ASM_SERIAL_NBR,NUMERICALTS,HGEAR_PART_NUMBER, HGEAR_PART_NUMBER2,HGEAR_PART_NUMBER3,DESIGNATOR,DESIGNATOR2,DESIGNATOR3,COMP_CONDITION_4,MAJ_ASM_SE RIAL_NBR,NUMERICALTS,HGEAR_PART_NUMBER,HGEAR_PART_NUMBER2,HGEAR_PART_NUMBER3,DESIGNATOR,DESIGNATOR2, DESIGNATOR3,COMP_CONDITION_5,SCR_REMARKS,IRC_REMARKS,LOCSUBMIT
HGEAR_PART_NUMBER=
HGEAR_PART_NUMBER2=
HGEAR_PART_NUMBER3=
IRC_REMARKS=
LLCCOLORCODE=REDLLC,REDLLC,
LLCCOLORTEXT=XXXXXX-XX EXPIRED ON DD-MON-YYYY,,
LOCSUBMIT=Submit
MAJ_ASM_NAME=B52-6
MAJ_ASM_PART_NBR=123456-77
MAJ_ASM_SERIAL_NBR=1,2,3,4,5
NUMERICALTS=
OTHCOLORCODE=REDOTH,REDOTH,
OTHCOLORTEXT=,OTHER GENERIC RED REASON,
SCR_REMARKS=Received on-hand.
YELCOLORCODE=YELLOW,YELLOW,
dfred 07-03-2001, 02:49 PM just wanted to get this to the top of the forum to see what other ideas people may have for me. I am very close to figuring this out.
dfred 07-05-2001, 04:31 PM thought I would get this back into circulation. I have another solution to my data passing problem which entails using a table to store the values till the parent page is submitted. Maybe someone can see this and give me some help.
DAN
vBulletin® v3.6.4, Copyright ©2000-2008, Jelsoft Enterprises Ltd.
|