SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Addict mcrumlish's Avatar
    Join Date
    Jan 2002
    Posts
    384
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    passing form values to a popup window with javascript

    Hi,

    This problem is in 2 parts:

    1 -

    I have a page with a form where a user enters their name and their password. The form also has a number of hidden fields. What I need to do is, when the user clicks the submit button of the form, a popup window appears that is passed all of the values of the form. I do not have access to a server side language like PHP to do this so is there any way to do it with javascript?

    2 -

    In the popup window, there is a form which has the same fields as the form in part 1 except I want the fields all to be hidden and to take on the value that is passed from part 1. Then, when the popup loads I want it to auto submit the hidden form. (using onload?)

    Here is the form fields:
    Code:
    <input type="hidden" name="action" value="do_login1">
    <input type="hidden" name="loginUID" value="10309978">
    <input type="hidden" name="FormName" value="fmLogin">
    <input type="hidden" name="main" value=login>
    <input type="text" name="username">
    <input type="text" name="password">
    Any help is much appreciated!

    Thanks,
    Martin

  2. #2
    SitePoint Guru Vincent Puglia's Avatar
    Join Date
    Feb 2000
    Location
    where the World once stood
    Posts
    700
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    1) document.formname.fieldname.value = opener. document.formname.fieldname.value

    2) <body onload=doit()>
    function doit()
    {
    document.formname.submit()
    }

    Vinny
    Where the World Once Stood
    the blades of grass
    cut me still

  3. #3
    SitePoint Enthusiast
    Join Date
    Aug 2002
    Posts
    28
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i tried

    document.upload.filename.value = opener. document.upload.filename.value

    to pass a value to pop-up using showmodaldialog, but the pop up does'nt seem pick up the value.

    basically i have a fileupload form which will submit to a pop-up and the progress bar will run i the pop-up. the popup submits the filename using a hidden field onLoad(of the pop-up).

    i have attached the code can you tell me whats wrong.

    thanx in advance for your help.

    ***************CODE***************
    filename.html
    ***************Starts Here***************
    <html>
    <head>
    <script language="javascript1.1">
    function doit()
    {
    document.upload.filename.value = opener. document.upload.filename.value

    sList=window.showModalDialog("pop-up.html","upo","");
    }
    </script>
    </head>
    <body>
    <form name="upload" method="post" action="">
    <input type="file" name="filename"><br>
    <input type="submit" name="Submit" value="Submit Filename To Pop-up" onClick="doit();">
    </form>
    </body></html>


    ***************CODE***************
    pop-up.html
    ***************Starts Here***************

    <HTML>
    <HEAD>
    <TITLE>Stock List</TITLE>
    <SCRIPT LANGUAGE="JavaScript">
    <!--
    var fname = opener.document.upload.filename.value
    function al()
    {
    alert(fname);
    }

    // -->
    </SCRIPT>
    </HEAD>
    <BODY>
    <a href=# onclick="al();">Click here to see the filename. </a><br>
    <form name="upload" method="post>
    <input name="filename" type="hidden"></form>
    <input name="Close" type="button" value="Close" onclick="window.close();">
    </BODY>

    ******************Code End*************
    Web Design Chennai
    Web Hosting Chennai
    Search Engine Optimization Chennai
    www.rhytha.com


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •