The Cache: Technology Expert's Forum
 
*
Welcome, Guest. Please login or register. December 01, 2008, 01:16:23 PM

Login with username, password and session length


Pages: [1]
  Print  
Author Topic: Ima Gomer here with a dumb JS question ...  (Read 412 times)
jairez
Journeyman
***
Offline Offline

Posts: 69


JTFC!


View Profile
« on: July 22, 2008, 12:29:31 PM »

OK, I've poured over the JS section like the Zapruder film and can't for the life of me figure this out, and me thinks it's stupid-simple.

I'm opening a child window to do a db search and need to either pass the results back to the parent, or just let the parent know when the child has been closed. 

q: what's window event I need to trap for?  How is it triggered? Is there something I need to set up at the parent before opening the child? Do these pants make my ass look big?

For now, I'm using cookies to store the db results (heavy lifting courtesy of ColdFusion), but I'd rather pass an array or something back to the parent window if that's possible.

Code:
function xopenChildWin()
{
features = "height=250,width=550,toolbar=no,menubar=no,resizable=yes,scrollbars=yes"
popup = window.open("getalt.cfm", "searchWin", features);
}

Any help greatly appreciated!  Much grass.

   -ja


Logged

Two wrongs don't make a right --- but three rights make a left.
perkiset
Olde World Hacker
Administrator
Lifer
*****
Online Online

Posts: 5211


:sniffle: Humor was so much easier before.


View Profile
« Reply #1 on: July 22, 2008, 01:29:17 PM »

Heyya JA - I've not done that in a great long while... I remember it to be a bit brittle unless you did it spot on. May I ask why you have to open another window to get the parameters from the user? Could it not be either blended into the calling page or in a hidden div that you pop up? That would be considerably stronger and easier. And you'd avoid popup blockers.

Consider this: If you have a div that is all of the query questions you want to ask, make it display:none on the calling page. When the user wants it, open it as z-index 1000 (or whatever you need to be on top of the current page) and center it. When the user presses either "OK" or "Cancel" you hide the div again and you have all the parameters you want in any format that you want them.

Just a thought...
Logged

If I can't be Mr. Root then I don't want to play.
jairez
Journeyman
***
Offline Offline

Posts: 69


JTFC!


View Profile
« Reply #2 on: July 22, 2008, 04:29:58 PM »

I s'pose I could do it that way, but since I'm doing this in CF there's a round-trip to the server and back I need to make and I don't want to monkey with the state of the parent window.  My result set will max out at 16K records of 1K per record and I don't want to front-load the page with that overhead.

That said, I CAN do it that way, but I think I'd rather try and pass something back or write/review cookies.

Good thought ... any others?

Always appreciated.

    -ja
Logged

Two wrongs don't make a right --- but three rights make a left.
perkiset
Olde World Hacker
Administrator
Lifer
*****
Online Online

Posts: 5211


:sniffle: Humor was so much easier before.


View Profile
« Reply #3 on: July 22, 2008, 06:54:42 PM »

...since I'm doing this in CF there's a round-trip to the server and back I need to make and I don't want to monkey with the state of the parent window.
Ah, so an almost-all Javascript client side deal is the wrong choice. But then, I guess I am confused: if you're not Javascripting, then communication between windows is weird... if you are communicating *completely* via the server, then cookies or post fields are your best bet.

Perhaps I'm missing something here...
Logged

If I can't be Mr. Root then I don't want to play.
jairez
Journeyman
***
Offline Offline

Posts: 69


JTFC!


View Profile
« Reply #4 on: July 22, 2008, 09:04:03 PM »

Quote
then cookies or post fields are your best bet.
That's what I thought, and actually what I first coded.  I've written the cookies and can close the window, but then how do I let the parent window know I'm finished?

I guess I could start a timer on the page and check a variable every few moments to see if it's been modified (cookie set to T/F by child window), but it seems like that may be a bit overkill for what I'm trying to do.

Is this a DOM solution with defining, opening and running the child window from the parent?  If so, how would I do that?

Am I oversimplifying the issue here?  This can't be rocket science.

As always ... very much appreciated.

     - Gomer


Logged

Two wrongs don't make a right --- but three rights make a left.
perkiset
Olde World Hacker
Administrator
Lifer
*****
Online Online

Posts: 5211


:sniffle: Humor was so much easier before.


View Profile
« Reply #5 on: July 22, 2008, 10:39:09 PM »

I just googled a bit and I think that this guy has a reasonable demo with explanation:

http://codepunk.hardwar.org.uk/bjs12.htm

It's not terribly tough as he describes it and should be self explanatory. Ping if you get into it and the child talks back  ROFLMAO
Logged

If I can't be Mr. Root then I don't want to play.
jairez
Journeyman
***
Offline Offline

Posts: 69


JTFC!


View Profile
« Reply #6 on: July 23, 2008, 09:24:39 AM »

The little bastard is indeed talking back .... -ish!

Not fully coded yet, but the article you referenced gave me exactly what I needed and that was to simply populate the parent window with window.opener.document.getElementByID('field here').value = "me arse", then close the child and put some checking on the submit button of the parent.

"Brilliant" - Guiness commercial guys

Thanx, Hoss!  Very much appreciated.  Praise

  -ja

btw - why do I get the feeling you already knew this but wanted to send me out on my own fact-finding mission?   Devilish  (things that make you go hhhmmmm)
Logged

Two wrongs don't make a right --- but three rights make a left.
perkiset
Olde World Hacker
Administrator
Lifer
*****
Online Online

Posts: 5211


:sniffle: Humor was so much easier before.


View Profile
« Reply #7 on: July 23, 2008, 11:48:41 AM »

Personally, I prefer things that make her go hummmmm....  ROFLMAO

Sounds to me like you now have a frame of reference to remember it oh-so good now Wink
Logged

If I can't be Mr. Root then I don't want to play.
jairez
Journeyman
***
Offline Offline

Posts: 69


JTFC!


View Profile
« Reply #8 on: July 23, 2008, 01:56:36 PM »

Quote
Personally, I prefer things that make her go hummmmm....  ROFLMAO

"Come on party-lips!  Finish up already!" - Remember that one? 

Again, in all sincerity, much thanks!  Yes ... I'm now fully frame-of-referenced     (see Hendrix)   
Logged

Two wrongs don't make a right --- but three rights make a left.
Pages: [1]
  Print  
 
Jump to:  

Perkiset's Place Home   Best of The Cache   phpMyIDE: MySQL Stored Procedures, Functions & Triggers
Politics @ Perkiset's   Pinkhat's Perspective   
cache
mart
coder
programmers
ajax
php
javascript
Powered by MySQL Powered by PHP Powered by SMF 1.1.2 | SMF © 2006-2007, Simple Machines LLC
Seo4Smf v0.2 © Webmaster's Talks


Valid XHTML 1.0! Valid CSS!