SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    Don't eat yellow snow spaceman's Avatar
    Join Date
    Mar 2001
    Location
    Melbourne, Australia
    Posts
    1,039
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Let's say I have a web page that displays a list of names and addresses (produced using PHP & MySQL, but that's not relevant for this discussion).

    I can put a link on this page that will open up a new browser window for the purposes of entering some search criteria, eg:

    <A HREF='search.htm' onClick="window.open('search.htm', 'RIC','width=300,height=300,resizable=no,scrollbars=no'); return false;">search window</a>

    The HTML code in search.htm is just a regular FORM. But my question is - how do I ensure that when I click the SUBMIT button on the pop-window that the data is posted back to the main display page (which thereby causes a revised list to be displayed)? I know it's to do with 'target' and 'POST', but I'm can't seem to put my finger on the info I need to make this happen (in a cross-browser compatible way).

    Perhaps I have to in some way 'name' the target page in the same way I might do a frame?

    Should be an easy one for someone that knows...

  2. #2
    SitePoint Zealot
    Join Date
    Mar 2001
    Location
    Los Angeles
    Posts
    100
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    That's a good one

    My first thought is to use the parent child relationship to populate hidden fields on the parent page with the values from the form on the child. Then use a function in the child page to post the form on the parent page.

  3. #3
    Don't eat yellow snow spaceman's Avatar
    Join Date
    Mar 2001
    Location
    Melbourne, Australia
    Posts
    1,039
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks very much for your suggestion, but I just worked it out myself...

    The trick was to name my main browser window like this:

    <SCRIPT LANGUAGE="JavaScript">
    window.name = "main";
    </SCRIPT>

    Then from my pop-up window, to post the data back to 'main' the FORM element looks like this:

    <FORM action="main.php" METHOD="POST" target="main">

    It's actually a neat little effect for separating a search form (the pop-up window) from the results list (the main window).


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
  •