OT js question (child window passing back to parent)
Could anybody show me how I would pass values from a child window back to the parent window? I have a form with a link that spawns a window, and from the new page, the user selects some checkboxes. I wanted to pass the values back into a form field in the parent window. I'm getting an error message that says the parent window's form field is null or not an object. Here is what I have: Parent Window: FORM NAME=newCaseInfo ACTION=index.cfm?action=caseAnalysissubaction=createNewCase METHOD=POST onSubmit=return validateUnits(); Form that I'm trying to populate with Child window data: INPUT TYPE=text NAME=actionReason VALUE= SIZE=5nbsp;nbsp;A HREF=javascript:openFrameless2() CLASS=text9ptBlackCodes/A Child Window: SCRIPT LANGUAGE=JavaScript function passToParent() { window.opener.document.newCaseInfo.actionReason.value = document.actionReason.actionReasonCode.value; return false; window.close(); } /SCRIPT FORM NAME=actionCode ACTION=index.cfm?action=caseAnalysissubaction=createNewCase METHOD=POST onSubmit=return passToParent(); INPUT TYPE=checkbox NAME=actionReasonCode VALUE=#actionReasonCode# Thanks ~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Signup for the Fusion Authority news alert and keep up with the latest news in ColdFusion and related topics. http://www.fusionauthority.com/signup.cfm
Re: OT js question (child window passing back to parent)
Tim, window.opener is the parent object. You can set any form element from the child window using the Javascript statement window.opener.formname.inputelementname.value = document.formname.fieldname.value; I hope this helps. -- Original Message -- From: Tim Do [EMAIL PROTECTED] Reply-To: [EMAIL PROTECTED] Date: Fri, 18 Oct 2002 08:28:09 -0700 Could anybody show me how I would pass values from a child window back to the parent window? I have a form with a link that spawns a window, and from the new page, the user selects some checkboxes. I wanted to pass the values back into a form field in the parent window. I'm getting an error message that says the parent window's form field is null or not an object. Here is what I have: Parent Window: FORM NAME=newCaseInfo ACTION=index.cfm?action=caseAnalysissubaction=createNewCase METHOD=POST onSubmit=return validateUnits(); Form that I'm trying to populate with Child window data: INPUT TYPE=text NAME=actionReason VALUE= SIZE=5 A HREF=javascript:openFrameless2() CLASS=text9ptBlackCodes/A Child Window: SCRIPT LANGUAGE=JavaScript function passToParent() { window.opener.document.newCaseInfo.actionReason.value = document.actionReason.actionReasonCode.value; return false; window.close(); } /SCRIPT FORM NAME=actionCode ACTION=index.cfm?action=caseAnalysissubaction=createNewCase METHOD=POST onSubmit=return passToParent(); INPUT TYPE=checkbox NAME=actionReasonCode VALUE=#actionReasonCode# Thanks ~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Your ad could be here. Monies from ads go to support these lists and provide more resources for the community. http://www.fusionauthority.com/ads.cfm
RE: OT js question (child window passing back to parent)
Tim Do wrote: Could anybody show me how I would pass values from a child window back to the parent window? I have a form with a link that spawns a window, and from the new page, the user selects some checkboxes. I wanted to pass the values back into a form field in the parent window. I'm getting an error message that says the parent window's form field is null or not an object. [snip] Child Window: SCRIPT LANGUAGE=JavaScript function passToParent() { window.opener.document.newCaseInfo.actionReason.value = document.actionReason.actionReasonCode.value; return false; window.close(); } /SCRIPT FORM NAME=actionCode ACTION=index.cfm?action=caseAnalysissubaction=createNewCase METHOD=POST onSubmit=return passToParent(); INPUT TYPE=checkbox NAME=actionReasonCode VALUE=#actionReasonCode# It looks like you're defining the path to the parent object just fine. But, unless it's a typo, the code for accessing the child object is incorrect. The child object form field name is actionReasonCode contained in a form named actionCode. But your JS code refers to it as: document.actionReason.actionReasonCode.value This should be actionCode as in: document.actionCode.actionReasonCode.value -- Mosh Teitelbaum evoch, LLC Tel: (301) 625-9191 Fax: (301) 933-3651 Email: [EMAIL PROTECTED] WWW: http://www.evoch.com/ ~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Signup for the Fusion Authority news alert and keep up with the latest news in ColdFusion and related topics. http://www.fusionauthority.com/signup.cfm
RE: OT js question (child window passing back to parent)
Looks like you may have mis-referenced your child form name -- it's actually actionCode not actionReason. Gene -Original Message- From: Tim Do [mailto:TDo;lahd.lacity.org] SNIP Parent Window: FORM NAME=newCaseInfo ACTION=index.cfm?action=caseAnalysissubaction=createNewCase METHOD=POST onSubmit=return validateUnits(); Form that I'm trying to populate with Child window data: INPUT TYPE=text NAME=actionReason VALUE= SIZE=5nbsp;nbsp;A HREF=javascript:openFrameless2() CLASS=text9ptBlackCodes/A Child Window: SCRIPT LANGUAGE=JavaScript function passToParent() { window.opener.document.newCaseInfo.actionReason.value = document.actionReason.actionReasonCode.value; return false; window.close(); } /SCRIPT FORM NAME=actionCode ACTION=index.cfm?action=caseAnalysissubaction=createNewCase METHOD=POST onSubmit=return passToParent(); INPUT TYPE=checkbox NAME=actionReasonCode VALUE=#actionReasonCode# ~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm
RE: OT js question (child window passing back to parent)
Thank you... now I have another issue with this... can I pass back multiple values? I output a list of checkboxes and want to pass back all the values the user checks on the child form. -Original Message- From: Gene Kraybill [mailto:Gene.Kraybill;adelphia.com] Sent: Friday, October 18, 2002 8:58 AM To: CF-Talk Subject: RE: OT js question (child window passing back to parent) Looks like you may have mis-referenced your child form name -- it's actually actionCode not actionReason. Gene -Original Message- From: Tim Do [mailto:TDo;lahd.lacity.org] SNIP Parent Window: FORM NAME=newCaseInfo ACTION=index.cfm?action=caseAnalysissubaction=createNewCase METHOD=POST onSubmit=return validateUnits(); Form that I'm trying to populate with Child window data: INPUT TYPE=text NAME=actionReason VALUE= SIZE=5nbsp;nbsp;A HREF=javascript:openFrameless2() CLASS=text9ptBlackCodes/A Child Window: SCRIPT LANGUAGE=JavaScript function passToParent() { window.opener.document.newCaseInfo.actionReason.value = document.actionReason.actionReasonCode.value; return false; window.close(); } /SCRIPT FORM NAME=actionCode ACTION=index.cfm?action=caseAnalysissubaction=createNewCase METHOD=POST onSubmit=return passToParent(); INPUT TYPE=checkbox NAME=actionReasonCode VALUE=#actionReasonCode# ~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Your ad could be here. Monies from ads go to support these lists and provide more resources for the community. http://www.fusionauthority.com/ads.cfm