Re: link in ModalDialog
| From: | vlad georgescu | Date: | Tue, 16 Nov 2004 18:20:23 +0000 |
| Subject: | Re: link in ModalDialog | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-202192@lists.php.net to get a copy of this message | ||
first of all thanks for response.
and second, some clarification. i have a main window (with a txtarea -
html-editor), from this page I want to open a little page
(upload_img.php) to handle the uploadimg2-onserver and return
path2img-onserver (where was uploaded) on close.
showModalDialog in js open a page in modal mode (on top). this type of
window can return a value (the parent is waiting until child is
closed), but, as I telling you, any link/redirect in modal window
opens a new one instead of opening in the same window. due to this I
can't use POST in upload_img.php.
the solution was in using a non-modal window for upload_img.php, and
returning result with js opener reference
(opener.document.forms[0].htmled.value+= "<img src='img/xyz.gif'>";)
regards,
On Mon, 15 Nov 2004 13:38:27 -0500, Gryffyn, Trevor
<tgryffyn@air-cargo-inc.com> wrote:
> I didn't see an answer to this, so thought I'd drop you a note.
>
> I've never used the "showModalDialog" function in JS.. Is it something
> built into JS or is it some other function that does a window.open or
> something like that?
>
> Anyway, a "modal" dialog box in regular programming terms is a window
> that'll open in addition to the regular application window and not allow
> you to interact with the parent window until the modal dialog is closed.
>
> Try opening a "File.." dialog box in any Windows application and you get
> an idea of what I'm talking about. You can't do anything with that app
> until you close that "File..." dialog box.
>
> Now, I'm not quite sure what you're asking here but it sounds like your
> process is happening like this:
>
> 1. You have a main window with whatever HTML or PHP script or whatever
> in it. In this window, you have an "upload" button or something.
>
> 2. You click on the "upload" button or link (or maybe this happens
> onLoad or something) and a new window opens with upload_img.php in it.
> This handles the file selection and/or the whole upload itself, pasting
> some kind of data either in this window or in the parent window (not
> quite clear on that).
>
> 3. You're trying to go to another link fro mthe upload_img.php modal
> window and it's opening yet another (third) window.
>
> Couple of things to think about:
>
> 1. Do you want the upload_img.php in the main window or in a little side
> popup window?
>
> 2. Do you want the popup window to close and return to the main window
> when it's done the upload?
>
> 3. Do you want the popup window to stay while you do other stuff?
>
> 4. Do you want links clicked on in the popup window to display within
> the popup or in the main window?
>
> In Javascript as well as in normal HTML, there's the concept of the
> "parent" window. In HTML, you can do:
>
> <a href="somelink.html" target="_new">Some link</a>
>
> Then from the new page that's opened, do:
>
> <a href="someotherlink.html" target="_parent">Link to open in parent
> window</a>
>
> Something like that (my syntax may be a little off.. I don't use parent
> a lot).
>
> There are similar functions in Javascript. You can also name windows
> and use them as the target:
>
> <a href="somelink.html" target="popup-window">Some link to show in
> popup</a>
>
> <a href="somelink.html" target="main-window">Some link to show in
> main
> window</a>
>
> The first one, target "popup-window" will open a new window if one named
> "popup-window" doesn't exist. The second one will also open a new
> window if you havn't used Javascript to name the current window or used
> a target = "main-window" already. But then as long as that window stays
> open, any targets pointing to "main-window" will go there.
>
> In the past, when I've used popups with javascript, it's happened like
> this:
>
> 1. Main window has a link that creates popup using JS and window.open or
> whatever it is... Usually without scroll bars, with a specific window
> size, etc.
>
> 2. The popup window does some kind of thing and once it's done, has a
> "close window" option. The close window option runs another JS that
> refreshes the "parent" window to reflect the changes made in the popup
> window. This is usually done by sending it parameters in the URL (and
> retrieved via a $_GET variable) or with a general refresh with no
> parameters and it gets the query parameters from session variables.
>
> The variables are usually something like what page in a long listing
> you're on.... Or whate query you did to get the information displayed.
> Like I did an online catalog for a very large country store. You might
> do a query for "show me all jellies, jams and preserves", then with 20
> listed per page, on the 5th page, you edit the price of one of them. Or
> the inventory quantity or the description or something. Once you're
> done doing that in the popup, it says "Done! Click to close window",
> then either via the URL or via session variables, tells the parent
> window to display Jellies/Jams/Preserves, 20 items per page, 5th page.
> If you do a delete and there might not be 5 pages anymore, you might
> want to do "If requesting page 5.. And only 4 pages are found.. Make it
> page 4 instead" or just go back to page 1. Otherwise, you might get a
> blank listing, or have something give a nasty error message.
>
> Sorry, I don't really have time to look up the specifics of the
> javascript stuff, but I hope I've given you an idea of how to do this.
> I'd check places like http://www.webmonkey.com for some
> great JS
> tutorials (amusing too). But sounds like you just have a targeting
> issue.
>
> Good luck!
>
> -TG
>
>
>
>
> > -----Original Message-----
> > From: vlad georgescu [mailto:startx@gmail.com]
> > Sent: Wednesday, November 10, 2004 7:13 AM
> > To: php-general
> > Subject: [PHP] link in ModalDialog
> >
> >
> > i'm working at some kind of HTLM editor for a web-page,
> >
> > and have in page, some js code which showModalDialog('upload_img.php')
> > and read the window return values and paste-it in page (text area).
> > the upload_img.php uploads img and returns the value to pe paste in
> > page (remote location of uploaded file).
> >
> > the problem is any link, redirect I do in ModalDialog, a new
> > page is open ...
> >
> > any ideea .. how to resolve this .. ?
> >
> > PS: question is a little bit offtopic, but pls help
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
>