JavaScript Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingJavaScript Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
  #1  
Old September 1st, 2006, 05:11 PM
Skeeza Skeeza is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Sep 2006
Posts: 6 Skeeza User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 38 m 30 sec
Reputation Power: 0
Question Targeting form from popup window to frames

Hi folks..

ok i have a popup window which i have created in which there is a code i wish to send to a form within a frameset if that make sense.

<a href="javascriptarent.frames[2].setSmiley1(':-)')">

this is the code im using which works fine when embeded within one of the frames within the frameset but it cant seem to work when it is issued from a popup window. Obviously it is an issue to do with locating the frame[2]?

Please can anyone advise?

Reply With Quote
  #2  
Old September 1st, 2006, 05:30 PM
colton22's Avatar
colton22 colton22 is offline
\ ^_^ / - Moderator
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jun 2006
Location: near chicago, Illinois
Posts: 471 colton22 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 Days 1 h 9 m 44 sec
Reputation Power: 3
Send a message via AIM to colton22 Send a message via MSN to colton22 Send a message via Yahoo to colton22
i have a few examples that may work, im not sure though, not tested...

from pop-up window do this....

opener.frame[2].formname.inputname.value=newvalueyouwanttopassin;

or try...

opener.getElementByID('frame[2]').formname.inputname...

try the above and please post back if this has helped.

colton22

Reply With Quote
  #3  
Old September 1st, 2006, 05:51 PM
Skeeza Skeeza is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Sep 2006
Posts: 6 Skeeza User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 38 m 30 sec
Reputation Power: 0
Hi..

thanx for the reply..

This is the code which is placed within a cgi file:

}
var clicks = 1
function setSmiley1(s) {
document.send.message.value += s + ''
}

So when the link is clicked it should send the info to the form named send and the input field message.

it works great when embbeded within a page located in one of the frames, but when in a popup it returns a null object error message.

I tried your idea but it didnt seem to work either..

thanx

Reply With Quote
  #4  
Old September 1st, 2006, 05:58 PM
colton22's Avatar
colton22 colton22 is offline
\ ^_^ / - Moderator
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jun 2006
Location: near chicago, Illinois
Posts: 471 colton22 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 Days 1 h 9 m 44 sec
Reputation Power: 3
Send a message via AIM to colton22 Send a message via MSN to colton22 Send a message via Yahoo to colton22
well why are you accessing this form by just document? is this on the main page?

please post your file or code

Reply With Quote
  #5  
Old September 1st, 2006, 06:03 PM
Skeeza Skeeza is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Sep 2006
Posts: 6 Skeeza User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 38 m 30 sec
Reputation Power: 0
Normally this feature is placed within the frames which when clicked it works, thats the code for it to work when in the frames.

I'm trying to get this code to work from a popup window instead of it being embedded within the frames.

I know this sounds confusing, but it's got me a bit baffled as to how to get it to post to the form within frame[2] from a popup window.

Quote:
Originally Posted by colton22
well why are you accessing this form by just document? is this on the main page?

Reply With Quote
  #6  
Old September 1st, 2006, 06:12 PM
colton22's Avatar
colton22 colton22 is offline
\ ^_^ / - Moderator
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jun 2006
Location: near chicago, Illinois
Posts: 471 colton22 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 Days 1 h 9 m 44 sec
Reputation Power: 3
Send a message via AIM to colton22 Send a message via MSN to colton22 Send a message via Yahoo to colton22
suppose the frame page's name that contains the form named "send" with the input named "message" was named "frame[2]" (idk if it is)

if the function setSmiley1(s), is in that pop-up page, access it from the form input box in the frame[2] by using the following in your pop-up window...

function setSmiley1(s) {
opener.frame[2].document.send.message+=s;
}

now this will ONLY work if that page consealing frame[2] is the page that opened the pop-up, if it is not the "opener" (hint the opener. code above), there is not relationship with the page because of a javascript "rule".

hope this helped

colton22

Reply With Quote
  #7  
Old September 1st, 2006, 06:59 PM
Skeeza Skeeza is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Sep 2006
Posts: 6 Skeeza User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 38 m 30 sec
Reputation Power: 0
hi thanx for the help..

will try that right away..

Is it possible to just have a popup open from any page and it locate the form, input named message in the frames[2]?


I created this about a year ago and it was fully working, but caqn i hell remember what i did to do this.

Any ideas?

I simply used the script i posted first off, but theres some thing im missing.

cheers

Reply With Quote
  #8  
Old September 1st, 2006, 07:07 PM
Skeeza Skeeza is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Sep 2006
Posts: 6 Skeeza User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 38 m 30 sec
Reputation Power: 0
hi thanx for the help..

will try that right away..

Is it possible to just have a popup open from any page and it locate the form, input named message in the frames[2]?


I created this about a year ago and it was fully working, but caqn i hell remember what i did to do this.

Any ideas?

I simply used the script i posted first off, but theres some thing im missing.

cheers

Reply With Quote
  #9  
Old September 1st, 2006, 08:46 PM
colton22's Avatar
colton22 colton22 is offline
\ ^_^ / - Moderator
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jun 2006
Location: near chicago, Illinois
Posts: 471 colton22 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 Days 1 h 9 m 44 sec
Reputation Power: 3
Send a message via AIM to colton22 Send a message via MSN to colton22 Send a message via Yahoo to colton22
actually without having reference between the windows, meaning, opener, top, parent, exc., it is a "safely law" in javascript so they cannot access, if you wanted to do this you could do the following, but it would be harder and take a whole different code.

if you want to access a string/numeric data with ANY window temporarily, you could store the string/numeric data within a cookie, and name it accordingly, make sure secure=false therefore you could access it from anywhere, the only problem with this is that you are guessing that the user is on one machine, remote or user based.

please post back w/ response. i will be back on tomorrow, it is 8:45pm here so yea,

colton22

Reply With Quote
  #10  
Old September 2nd, 2006, 09:40 AM
Skeeza Skeeza is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Sep 2006
Posts: 6 Skeeza User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 38 m 30 sec
Reputation Power: 0
It's ok i got it in the end.

The variable i was looking for was opener.parent

Works a treat.

Cheers for the ideas..

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingJavaScript Development > Targeting form from popup window to frames


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 5 hosted by Hostway