HTML Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsWeb DesignHTML Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old October 12th, 2000, 03:18 PM
iwarford iwarford is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2000
Posts: 2 iwarford User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0

Here's the deal.

I have a text input box in one window. There's a link beside it which has an onclick that opens a new window using window.open(). This contains a calendar - the idea is that you click on the day in the calendar, and it fills in the text box on the original page.

What I was doing on the originating page was this :

var w = window.open("calendar.jsp", "calendar", "blah=blah....");
w.document.targetForm = document.forms['frmOrder'].txtDateRequired;
.
.


And, on the calendar page, I was doing this when someone clicked on a 'day' :

var sDateString = selectedDay."/".selectedMonth."/".selectedFullYear;
document.targetForm.value = sDateString;
.
.
.

Now, by slapping together a simple demonstration with a few HTML pages, this works. Great. But now that I've gotten the page in the framework, and it's working beautifully (there are select boxes on the calendar to change the month & year, and it dynamically changes the layout of the calendar to suit) except for this part. The calls to document.targetForm.value = sDateString just don't work now.

However, for the whacked out part?

If I change

var w = window.open("calendar.jsp", "calendar", "blah=blah....");
w.document.targetForm = document.forms['frmOrder'].txtDateRequired;

to

var w = window.open("calendar.jsp", "calendar", "blah=blah....");
alert(document.forms['frmOrder'].txtDateRequired);
w.document.targetForm = document.forms['frmOrder'].txtDateRequired;

I get an alert box saying [Object], but it works. Perfectly.

I'm probably going to have to clarify some of this, but I'm wondering if this kind of problem sounds familiar to anyone.

Reply With Quote
  #2  
Old October 13th, 2000, 03:41 PM
voicebox voicebox is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2000
Posts: 2 voicebox User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Yes, I've heard of this problem before. It occurs if you set a property of a window directly after it is created. If you want to communicate this setting to the jsp page, change the code:

w.document.targetForm = document.forms['frmOrder'].txtDateRequired;

to:

document.targetForm = document.forms['frmOrder'].txtDateRequired;

And change:

document.targetForm.value = sDateString;

to:

opener.document.targetForm.value = sDateString;

This is the only way I have found around this problem.

Reply With Quote
  #3  
Old October 13th, 2000, 04:07 PM
iwarford iwarford is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2000
Posts: 2 iwarford User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
*bows*

Thanks muchly. Works great.

Reply With Quote
Reply

Viewing: Dev Shed ForumsWeb DesignHTML Programming > Passing a form between two windows?


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway
Stay green...Green IT