form action

PirateNinjaPirateNinja Icrontian
edited December 2006 in Internet & Media
I have a link that opens a login form in a new window. I want the login form in the new window to send the data to it's parent window, and close itself afterwords. How can I do this?

Holidays are coming :clap:

Comments

  • LincLinc Owner Detroit Icrontian
    edited December 2006
    Unless you're doing this with frames, I don't think it's possible. HTML can't keep track of windows and send info between them. You can use the "target" tag for forms to send it to a new window or within frame elements, but that's about it.

    How about just have the new window process the login and then close itself?
  • PirateNinjaPirateNinja Icrontian
    edited December 2006
    Unless you're doing this with frames, I don't think it's possible. HTML can't keep track of windows and send info between them. You can use the "target" tag for forms to send it to a new window or within frame elements, but that's about it.

    How about just have the new window process the login and then close itself?

    That would work fine, I just do not know how to direct the main window to their webmail interface (this is awebmail login) after the newly opened login window closes. This takes javascript knowledge I do not have.
  • LincLinc Owner Detroit Icrontian
    edited December 2006
    Ah, yeah, again, that would require passing info between windows.

    Can you just do it all in the same window? That's pretty much how everyone does it to my knowledge... I've never seen a two-window login process and would be a little suspicious if I did.
  • PirateNinjaPirateNinja Icrontian
    edited December 2006
    I'm not a fan of this seperate windows thing either, but it is what the bossman wants. The pop up is only X by Y pixels, the webmail interface ideally should be a full screen window. It's a pain, I think I will just tell him it can't happen. I don't have time to try and figure out how to make this thing work.
  • RWBRWB Icrontian
    edited December 2006
    I'm still new to PHP, but couldn't you pass the user name and password to a global variable on a separate page which the other page you mentioned will use in return? Or something along those lines?
  • LincLinc Owner Detroit Icrontian
    edited December 2006
    Sure with a session variable, but then the main window would need to auto-refresh or something to get the new data. There's still no way to tell the main window when the info has been submitted.
  • nonstop301nonstop301 51° 27' 24.87" N // 0° 11' 38.91" W Member
    edited December 2006
    There are some very nifty javascripts available to determine the action of submit forms.

    I think what he wants to achieve is to trigger two submit buttons on different pages (popup and main page that logs into the account) after the login information is entered in the popup.

    There are javascripts to activate submit buttons at the same time on different pages when one is pressed so that's the sort of thing he should look for. The button on the main page should be invisible to avoid confusion.

    I have to agree with the General though. It's a far more complex way to achieve a simple login :)
  • KyleKyle Lafayette, LA New
    edited December 2006
    In case you didn't already solve your problem, the code below should do the trick.

    The javascript function resides in your popup window. The popup window's form doesn't actually submit anything to an action page. The submit button just calls a function to transfer the appropriate values to a form (with hidden inputs) on your parent page. I believe the code also works using "parent" instead of "opener".

    [PHP]
    ...

    <script langauge="javascript">
    function transfer_values()
    {
    opener.document.myWebmailForm.user_id.value = document.myLoginForm.user_id.value;
    opener.document.myWebmailForm.password.value = document.myLoginForm.password.value;
    opener.document.myWebmailForm.submit();
    self.close();
    }
    </script>

    ...

    <input type="button" value="Submit" onClick="transfer_values();">
    ...
    [/PHP]
  • nonstop301nonstop301 51° 27' 24.87&quot; N // 0° 11' 38.91&quot; W Member
    edited December 2006
    Yes that's the sort of thing I was thinking about Kyle

    Nice little transfer_values script you posted there :)
Sign In or Register to comment.