Multiple Form Submit/Login to two Servers

Discussion in 'Javascript' started by plex4r, Mar 7, 2006.

  1. plex4r

    plex4r Guest

    I have a requirement to accept userid/password on a form and login to
    two servers. The authenticated homepage for each is to be displayed in
    two different iframes. I have an issue which I believe is a race
    condition because my code has worked a few times.
    I can make the code always work by putting an 'alert()' call between
    the submits. The code below shows where the alert box must be.
    The behavior I get without the alert() is normally the first form
    submit works, but nothing happens in the second submit.
    I have tried many things:
    1. Use setTimeout("funct()", time) to make the second submit occur
    after the first should be complete. I get the same results, requireing
    an alert() in funct().
    2. Point the initial iframe at the other servers login.jsp page and
    hardcode the username/password as strings. I get the same behavior
    requiring alert()

    Any ideas what I can do?

    Initial file with
    iframes================================================
    <html><head>
    <title>Portal Intranet</title>

    <body>


    <div id="portalBarDiv" style="width:800;
    background-color:lightblue; position:absolute; left: 0; top: 0;
    z-index:10" >
    <iframe id="portalBarIframe"
    name="portalBarIframe" src="/trifleet/pages/shared/login.jsp"
    align=left frameborder="0" width=1020 height=150 scrolling=no
    style="width:800; height: 800;
    border: none;">
    </iframe>
    </div>

    <div id="trifleetDiv" style="position:absolute;
    left: 0; top: 835; z-index: 6; ">
    <iframe id="trifleetIframe"
    name="trifleetIframe"src="" align=left frameborder="0" width=1020
    height=800 scrolling=yes
    style="border: none;">
    </iframe>
    </div>


    </body>
    </html>

    Login form ==========================================================
    <html>
    <head>
    <title>Login</title>
    <SCRIPT language="JavaScript" type="text/javascript">
    function OnClickLogin()
    {
    document.loginForm.target = "portalBarIframe";
    document.loginForm.submit();
    //alert("Block Here!");
    document.loginForm.action =
    "https://my.otherServer.com:446/trifleet/j_security_check";
    document.loginForm.target = "trifleetIframe";
    document.loginForm.submit();
    return true;
    }

    </script>

    <form name="loginForm" action="j_security_check" method="post">
    <!-- <FORM onsubmit='return OnClickLogin()' method="post"
    NAME="loginForm" action="j_security_check">
    -->
    <FORM method="post" NAME="loginForm" action="j_security_check">

    Name: <input type="text" size=25
    name="j_username" >
    <br>
    Password: <input type="password" size=25
    name="j_password">
    <INPUT TYPE="button" onclick="return OnClickLogin(); " >

    </form>
    </html>
    plex4r, Mar 7, 2006
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Mark
    Replies:
    3
    Views:
    498
    bruce barker
    Aug 26, 2004
  2. Matt
    Replies:
    0
    Views:
    676
  3. Replies:
    4
    Views:
    879
  4. Matt
    Replies:
    2
    Views:
    153
    Bob Barrows [MVP]
    Jun 27, 2004
  5. Replies:
    3
    Views:
    639
Loading...

Share This Page