CodeCharge Studio
search Register Login  

Web Reports

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> General/Other

 Popup form problem - window.opener.document

Print topic Send  topic

Author Message
TBMH

Posts: 40
Posted: 01/24/2007, 11:59 AM

This is driving me nuts. On closing my form and returning a value back to the parent form I can't get past this piece of JS code:

window.opener.document.INVOICE.VENDOR_NUMBER.value = VendNumber;

It just doesn't work. I've scoured the web and tried all sorts of things. This code should work without a problem.

And yes, I've looked at the sample and searched the forums for others with this problem. Still no anwer.

Please, for the love of human kind, help me with this.

The entire code snipet looks as follows:

function SetOpenerValue(currentObj)
{
var IE = (document.all) ? 1 : 0;
if(IE) {
var VendNumber = currentObj.innerText;
} else {
var VendNumber = currentObj.text;
}

window.opener.document.INVOICE.VENDOR_NUMBER.value = VendNumber;

window.opener.focus();
window.close();

}

Thanks!!
View profile  Send private message
peterr


Posts: 5971
Posted: 01/24/2007, 12:18 PM

Hi,

The code looks OK. Are you sure that VendNumber is not blank? For example have you tried displaying that value before returning it?
Also, how does your corresponding HTML code in the parent page looks like?
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com
View profile  Send private message
TBMH

Posts: 40
Posted: 01/24/2007, 1:07 PM

Hi Peter,

Thanks for the quick response. Yes - VendNumber does contain a value. If I add alert(VendNUmber) just before window.opener.document.INVOICE.VENDOR_NUMBER.value = VendNumber; it will display the correct value.

The parent code where I'm calling this form is as follows:

function OpenPop_UpList()
{

var win=window.open("popup2.aspx","VendorList", "left=100,top=10,width=600,height=480,status=yes,toolbar=no,menubar=no,location=no,scrollbars=yes");
win.focus();

}

The link where I call tOpenPop_UpList() on the parent form does not have an "id" value. If I put one in, then I get an error when I compile (C#) because the link has two ids. Here's the message:

Line 94: <a id="INVOICESLink1" href="" id="VendorList" onclick="OpenPop_UpList();return false;" runat="server" >Vendors</a>

Could that have anything to do with it? If so, how do I get around this?

Thanks again,
Scott
View profile  Send private message
peterr


Posts: 5971
Posted: 01/24/2007, 1:37 PM

I don't think that the link id or name would play any role here. I was rather asking about the HTML of the form that receives the value. So basically you have a form with name="INVOICE" and field with name="VENDOR_NUMBER"?
BTW, does the corresponding example in CCS Example Pack work for you?
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com
View profile  Send private message
TBMH

Posts: 40
Posted: 01/24/2007, 2:03 PM

Peter,

You are correct. I have a form named "INVOICE" and a field named "VENDOR_NUMBER". The example pack is confusing. It seems to be doing much more than I need it to. I have looked at it numerous times and just utilized the basic parts.

Here's something interesting - my popup form has a grid of vendors and the vendor number is the link. If I just drop a link on the form (not in the grid) and have it call SetOpenerValue(currentObj) I get an error saying that the target control (INVOICE.VENDOR_NUMBER) is not enclosed in a form (on the partent form) and must be set to runat=server.

Does this help?

Thanks,
Scott
View profile  Send private message
peterr


Posts: 5971
Posted: 01/25/2007, 11:15 AM

I asked if the example pack works for you just to make sure that anything of this nature works for you. If the example pack doesn't work then this might give us new clues about the problem.

Also, please check the HTML and JavaScript on a live page, to make sure that something doesn't get removed or modified during publishing.
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com
View profile  Send private message
robn

Posts: 70
Posted: 02/05/2007, 3:10 AM

Scott

which version of I.E. are you using if version 7 I have found that the code window.opener and window.close cannot be used and am looking for an alternative.

regards

Rob
View profile  Send private message
TBMH

Posts: 40
Posted: 02/05/2007, 11:43 AM

RObn,

I'm using IE 6. I still can't get this to work.

Scott
View profile  Send private message
Oper


Posts: 1195
Posted: 02/09/2007, 3:04 AM

We use that a lot , and our customer use IE7 withotu a problem. so is not a browser isue.

My sugestion is display evrethiny using alert in the html and echo/resposne in your code.

remeber that case sensitive is important.
(INVOICE.VENDOR_NUMBER.value are all CAPS?)


Coudl you copy paste the HTML part of the form where the VENDOR_NUMBER is?

_________________
____________________________
http://www.7bz.com (Free CMS,CRM Developed in CCS)

http://www.PremiumWebTemplate.com
Affiliation Web Site Templates

Please do backup first
View profile  Send private message
cleyan


Posts: 136
Posted: 02/25/2007, 10:07 AM

i use GetElementById()

function SetOpenerValue(currentObj)
{
var IE = (document.all) ? 1 : 0;
if(IE) {
var VendNumber = currentObj.innerText;
} else {
var VendNumber = currentObj.text;
}

window.opener.document.GetElementById('text_id') .value = VendNumber;

window.opener.focus();
window.close();

}

Don't forget to add an id tag to the textbox

Best Regards
_________________
**************************************************
Carlos Leyan B.
Temuco, Chile
www.leytec.net
View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

Web Database

Join thousands of Web developers who build Web applications with minimal coding.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.