Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Senior Coder chump2877's Avatar
    Join Date
    Dec 2004
    Location
    the U.S. of freakin' A.
    Posts
    2,859
    Thanks
    22
    Thanked 157 Times in 148 Posts

    submit form in popup window; send form data to opener window: ISSUE

    Ok, I have the following form and relevant code in my pop up window:

    PHP Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" />

    <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en" dir="ltr">

    <head>

    <title></title>

    <link rel="stylesheet" type="text/css" href="contact_reference.css" />

    <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />

    <script type="text/javascript">
    <!--

    function sendFormData(form_object)
    {
        remoteForm = window.opener.update_submit;

        remoteForm.first_name.value = form_object.first_name.value;
        remoteForm.last_name.value = form_object.last_name.value;
        remoteForm.business_name.value = form_object.business_name.value;
        remoteForm.email.value = form_object.email.value;
        remoteForm.website.value = form_object.website.value;
        remoteForm.phone.value = form_object.phone.value;
        remoteForm.street.value = form_object.street.value;
        remoteForm.city.value = form_object.city.value;
        remoteForm.state.value = form_object.state.value;
        remoteForm.zip.value = form_object.zip.value;
        remoteForm.country.value = form_object.country.value;
        remoteForm.submit();
        window.close();
    }

    -->
    </script>

    </head>

    <body>

    <form name="form4">

        <p>First Name: <input type="text" name="first_name" size="25" value="<? echo $the_fn?>"></p>
        <p>Last Name: <input type="text" name="last_name" size="25" value="<? echo $the_ln?>"></p>
        <p>Business Name: <input type="text" name="business_name" size="25" value="<? echo $b_name?>"></p>
        <p>E-mail Address: <input type="text" name="email" size="25" value="<? echo $the_email?>"></p>
        <p>Website Address: <input type="text" name="website" size="25" value="<? echo $the_website?>"></p>
        <p>Phone Number: <input type="text" name="phone" size="25" value="<? echo $the_phone?>"></p>
        <p>Street Address: <input type="text" name="street" size="25" value="<? echo $the_street?>"></p>
        <p>City: <input type="text" name="city" size="25" value="<? echo $the_city?>"></p>
        <p>State/Region: <input type="text" name="state" size="20" value="<? echo $the_state?>"></p>
        <p>Postal Code: <input type="text" name="zip" size="15" value="<? echo $the_zip?>"></p>
        <p>Country: <input type="text" name="country" size="25" value="<? echo $the_country?>"></p>

        <p style="text-align:center"><input type="button" value="Update Contact" onClick="sendFormData(window.document.form4);"><input type="reset" value="Reset Form"><input type="button" value="Cancel" onClick="window.close();"></p>

    </form>

    </body>

    </html>
    Using the javascript function sendFormData(), I'm trying to assign values to a hidden form in the opener window, submit the form in the opener window, and then close the pop-up window.

    Here's the hidden form in the opener window:

    PHP Code:
    <form method="post" name="update_submit" action="<? echo $_SERVER['PHP_SELF']; ?>">

    <input type="hidden" name="first_name">
    <input type="hidden" name="last_name">
    <input type="hidden" name="business_name">
    <input type="hidden" name="email">
    <input type="hidden" name="website">
    <input type="hidden" name="phone">
    <input type="hidden" name="street">
    <input type="hidden" name="city">
    <input type="hidden" name="state">
    <input type="hidden" name="zip">
    <input type="hidden" name="country">

    </form>
    Anyway, the javascript in my pop-up window is not functioning and nothing happens.

    I checked the javascript console, and I get the following error in my pop-up window's code:

    Error: remoteForm has no properties
    Source File: http://www.mediamogulsweb.com/blah/blah.php
    Line: 21
    Can anybody see what the problem is here? thanks.
    Last edited by chump2877; 05-01-2006 at 09:37 AM.
    Regards, R.J.

    ---------------------------------------------------------

    Help spread the word! Like my YouTube-to-Mp3 Conversion Script on Facebook !! :-)
    [Related videos and tutorials are also available at my YouTube channel and on Dailymotion]
    Get free updates about new software version releases, features, and bug fixes!
    ♪♪ …Need Web Hosting For My YouTube-To-Mp3 Conversion Software? Check Here !!… ♪♪

  • #2
    Senior Coder chump2877's Avatar
    Join Date
    Dec 2004
    Location
    the U.S. of freakin' A.
    Posts
    2,859
    Thanks
    22
    Thanked 157 Times in 148 Posts
    Code:
    remoteForm = opener.document.update_submit;
    fixed it.
    Regards, R.J.

    ---------------------------------------------------------

    Help spread the word! Like my YouTube-to-Mp3 Conversion Script on Facebook !! :-)
    [Related videos and tutorials are also available at my YouTube channel and on Dailymotion]
    Get free updates about new software version releases, features, and bug fixes!
    ♪♪ …Need Web Hosting For My YouTube-To-Mp3 Conversion Software? Check Here !!… ♪♪


  •  

    Posting Permissions

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