Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Iframes, parents, and forms

Options
  • 11-08-2005 3:39pm
    #1
    Closed Accounts Posts: 8,478 ✭✭✭


    I'm working on a site at the moment and I am having some issues with a form sitting within an Iframe. Once the form is submitted, I need it to go back to the parent window. So say index.html contains search.asp within an iframe. The results then need to go back to the parent page results.asp.

    I'm possibly using the incorrect code on the form, so could anyone take a look for me?

    index.html:
    <iframe scrolling="no" width="100%" height="100%" frameborder="0" src="http://www.urlEditedForTesting/sidesearch.asp?agentid=34"></iframe>
    

    sidesearch.asp (index iframe content):
    <form name="form1" method="post" action="http://urlEditedForTesting/careers.asp">
          
        <div align="right">
          <input name="Page" type="hidden" id="Page" value=1>
          <input type="hidden" name="AgentID" value=34>
          <img src="careerSearch.gif" width="125" height="46">    </div>
          <table width="100%" border="0">
          <tr> 
            <td width="7%">Discipline:</td>
            <td colspan="2"> 
              <select name="JobTitle" style="width:120px; height:20px; font-family:tahoma; font-size:11px ">
                <option value=ALL >ALL 
                
                 
                <option value='Manager' >Manager
                 
              </select>
            </td>
          </tr>
          <tr> 
            <td width="7%">Location:</td>
            <td colspan="2">
              <select name="Area" style="width:120px; height:20px; font-family:tahoma; font-size:11px ">
                <option value=ALL >ALL 
                
                 
                <option value=Cork                           >Cork                          
                 
                <option value=Kerry                          >Kerry                         
                
              </select></td>
          </tr>
          <tr>
            <td>Keyword:</td>
            <td width="12%" valign="middle">
              <input type="text" name="Keywords" style="width:120px; height:20px; font-family:tahoma; font-size:11px">
            </td>
            <td width="81%" valign="middle"><input name="Submit" type="image" src="go.jpg" alt="Submit" align="middle" border="0" onClick="parent.location='http://urlEditedForTesting/careers.asp'"></td>
          </tr>
        </table>
      </form>
    

    I would have thought that onClick="parent.location='http://urlEditedForTesting/careers.asp' would have worked above. When I load the iframe content on its own it passes the data fine, but when I load the parent page and iframe contents it loads the correct page but does not pass the data.

    Help :D


Comments

  • Moderators Posts: 6,861 ✭✭✭Spocker


    Try adding "target=_parent" to the <form> tag of the sidesearch.asp page - this tells the browser to load the response in the parent page - in your case at the top level, which is (I think) what you want.

    S.

    [edit]if _parent doesn't work, try _top instead. Parent is defined as the page that contains the iframe, whereas top is the topmost window, i.e. the main browser window[/edit]


  • Closed Accounts Posts: 8,478 ✭✭✭GoneShootin


    That did it - thanks! Dunno why I overlooked that.


  • Moderators Posts: 6,861 ✭✭✭Spocker


    Probably just a bad day ... :rolleyes:


Advertisement