• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

form with target=opener

 
Ranch Hand
Posts: 311
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I'd greatly appreciate advice on the following.
I am trying to create an javascript application which has main window, and an input dialog that pops out of the main window.
A simple flow example:
1. User navigates to the main window (say it represents an on-line book store). This window contains a button "Add Book".
2. User clicks the "add book" button.
3. As a result, an input dialog pops up. This dialog contains a form, allowing the user to type in the new book details.
4. Once the user presses "submit", I would like the form to be submitted (in POST mode), but here's the catch: i'd like the response (e.g. server reply) to be shown in the *main* window, and the dialog should close. In other words, I'd like to reply to be shown in the dialog's *opener*.

Now, I *have* managed to get the required result by assigning some hard-coded name to main window, and setting it as the form's target.
This works, but I don't like it:



As I said, this works, but appears a bit shaky to me.
In particular, I don't like the fact mainWindow assigns itselt a hard-coded name: what if the user creates several copies on mainWindow (e.g by using the browser's "open target in new window") ?

Was wondering whether other people have run into a similar requirement, and whether there's an elegant, standard way to do it ?

Thanks a lot
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Dealing with pop up windows in this day in age is not fun due to the pop up blockers. Some pop up blockers block the pop up windows that should not be blocked.

I would say try opening up a few instances of the window. I have a feeling that the pop up window will go back to its parent. I am not sure about it exactly.

Eric
 
Sol Mayer-Orn
Ranch Hand
Posts: 311
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks very much for your answer.
However, if you could excuse my newbe ignorance - what do you mean by "opening a new instance of the window" ? is this some way to open a window without calling "window.open" ?

BTW thanks for the "popup blockers" tip, but it's not a problem in my case (application is for internal company use only, and we allow popups).

Thanks again
 
Eric Pascarello
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You said you were worried about multiple windows open with the same application that is what I meant by new instancecs. Basically just goto the page and hit Ctrl - N which opens a new window.

Was that what you were worried about? I was not positive.

There are also ways to check if a pop up window is open already and to use/close that window.

example:


Eric
 
Sol Mayer-Orn
Ranch Hand
Posts: 311
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks very much
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic