|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
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. |
|
#2
|
|||
|
|||
|
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. |
|
#3
|
|||
|
|||
|
*bows*
Thanks muchly. Works great. |
![]() |
| Viewing: Dev Shed Forums > Web Design > HTML Programming > Passing a form between two windows? |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|