form action
PirateNinja
Icrontian
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
Holidays are coming
0
Comments
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.
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.
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
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]
Nice little transfer_values script you posted there