Results 1 to 4 of 4
  1. #1
    rkuwadia
    Guest
    Need Help for Pop Up windows
    Hello,

    I have a script in which from parent browser, I open a pop up window.
    Clicking submit on Pop up window, should close the pop up window and submit the
    values to the parent window.


    The code on parent window(say parent.php) is something like this:

    <script language=javascript>
    window.name="jobpost";
    window.open('xyz.php', 'xxx');
    </script>

    The code on xyz.php is something like this:
    <form name=form1 method=post target=jobpost>
    <input type=button value="Apply" onclick="javascript:OnApply();">
    </form>


    <script language=javascript>
    function onApply(){
    document.form1.action="parent.php";
    document.form1.submit();
    self.close();
    }
    </script>


    The above code works on windows IE as well as NN.
    But it doesnot work on Mac. It gives lot of errors . When I do not submit to parent window, no error comes.


    Can anyone help me on this issue?I have no button named Submit in pop up window as well as parent window.

    Thanks

  2. #2

    Murlyn's Avatar
    Member Since
    Jun 11, 2003
    Location
    Mount Vernon, WA
    Posts
    4,915
    Specs:
    MacBook Pro 2.6 GHz Core 2 Duo 4GB RAM OS 10.5.2
    Ok here is my popup code...

    Code:
    function popup( page, title, w, h, scroll ) {
      if (!title) title = 'Popup';
      if (!scroll) scroll = 'no';
      if (!w) w = 500;
      if (!h) h = 350;
      var wintop = (screen.height - h) / 2;
      var winleft = (screen.width - w) / 2;
      var atts = 'width='+w+',height='+h+',scrollbars='+scroll+',resizable,screenX=150,screenY=150,top='+wintop+',left='+winleft+'';
      win = window.open( page, title, atts);
      if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
    }
    When submitting to the parent window use

    Code:
    top.opener.location.href
    If you need more help please reply and we'll go through everything that you are doing.. it would help to see exactly what your code is.. maybe even a working example or at least the non working one

    Cheers!

  3. #3
    rkuwadia
    Guest
    Thanks for this much help.

    The problem is I need values from pop up window into the parent window.

    If I use, top.opener.location.href, then the page doesnot get submitted and I donot get values.

    If I use javascript to assign values, like top.opener.form1.field1.value it gives problem with array elements.

    I am using php to code.

    I have a field called grades which is an array.
    So to use something like following, doesnt work in Javascript.

    document.popup.grades[].value = top.opener.posting.grades[].value;


    Do you have any suggestion for the above problem?

  4. #4

    Murlyn's Avatar
    Member Since
    Jun 11, 2003
    Location
    Mount Vernon, WA
    Posts
    4,915
    Specs:
    MacBook Pro 2.6 GHz Core 2 Duo 4GB RAM OS 10.5.2
    Hmm... I see what you are saying.. Ok what I would do is submit the form to <?=$_SERVER["PHP_SELF"]?> then parse your post variables

    PHP Code:
    // Get the number of values in $grades array
    $numGrades count($_POST['grades']);

    // Go through every grade value and assign a new variable name
    for ($i=0$i<$numGrades$i++)
      
    $gradeArr[] = "grades{$i}=".$_POST['grades'][$i];

    // Transform the array into a URL string
    $grades implode('&'$gradeArr);

    // You might want to urlencode the string afterwards
    $grades urlencode($grades); 
    This will stick your array into this form:

    grade1=value&grade2=value&grade3=value

    so forth and so forth.. that should help you out a bit there..

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. How to stop pop up windows
    By stvrod7 in forum OS X - Operating System
    Replies: 3
    Last Post: 11-07-2014, 09:33 PM
  2. Windows POP folders
    By ScrappyDog in forum Switcher Hangout
    Replies: 4
    Last Post: 03-21-2012, 09:51 PM
  3. disable pop up windows
    By karenoganyan in forum OS X - Operating System
    Replies: 6
    Last Post: 10-12-2011, 06:29 PM
  4. Help on Mac with pop up windows
    By vole69 in forum Switcher Hangout
    Replies: 2
    Last Post: 08-24-2010, 06:20 PM
  5. Windows Registry Pop Up on MAC???
    By ruggerus in forum Switcher Hangout
    Replies: 4
    Last Post: 09-17-2005, 11:50 AM

Posting Permissions

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