Results 1 to 10 of 10

Thread: Getting a form result into a Iframe

  1. #1
    Registered
    Join Date
    Oct 2007
    Location
    Portugal
    Posts
    5
    Rep Power
    0

    Question Getting a form result into a Iframe

    Hello all!!

    I have a form that gets information from an external server and i need the results to be displayed on a Iframe under my website. It may be in a Iframe or displayed on a another page in my website, here a bit of the code i have :

    <form action="http://external.server.feeder.htm" method="GET" name="f" id="f" >
    <input type="hidden" name="LPR" id="LPR" value=0>
    <input type="hidden" name="MPR" id="MPR" value=0>

    .
    .
    .
    .

    input type="submit" value="Search" class="button" name="submit" id="submit" target="results"></td>
    <td><input type="reset" value="Reset" class="button" name="limpar" id="limpar"></td>

    </form>

    I hope you can help me on this

    Kind Regards

    Aclips

  2. #2
    satis's Avatar
    Join Date
    Oct 2002
    Location
    Dallas
    Posts
    2,914
    Rep Power
    21
    If you're just trying to target a frame or iframe with a form, you can give the form tag a target attribute

    ie: <form action="http://blahblahblah.com" target="myiframe">

  3. #3
    Registered
    Join Date
    Oct 2007
    Location
    Portugal
    Posts
    5
    Rep Power
    0
    Quote Originally Posted by satis View Post
    If you're just trying to target a frame or iframe with a form, you can give the form tag a target attribute

    ie: <form action="http://blahblahblah.com" target="myiframe">
    Hi satis, thanks for replying, i have done that but it is not showing on the iframe, its keeps opening a new page, here's the code i'm using:

    <form action="http://external.server.feeder.htm" method="GET" name="f" target="results" id="f" >
    <input type="hidden" name="LPR" id="LPR" value=0>
    <input type="hidden" name="MPR" id="MPR" value=0>
    .
    .
    .
    input type="submit" value="Search" class="button" name="submit" id="submit" target="results"></td>
    <td><input type="reset" value="Reset" class="button" name="limpar" id="limpar"></td>

    </form>

    "hidden" iframe, to post results:

    <iframe width="0" id=”results” name="results" height="0" border="0" frameborder="0" scrolling="auto" align="center" hspace="0" vspace=""></iframe>

    Regards

    Aclips

  4. #4
    You are what you is... troycawley's Avatar
    Join Date
    Nov 2006
    Location
    Wildwood, NJ
    Posts
    245
    Rep Power
    12
    ...or directly call the page you are "get" requesting with
    HTML Code:
    <iframe src="http://external.server.feeder.example.com?LPR=0&MPR=0&var3=phoney&var4=baloney"></iframe>
    Last edited by troycawley; 10-23-07 at 09:55 AM. Reason: added code tags

  5. #5
    Registered
    Join Date
    Oct 2007
    Location
    Portugal
    Posts
    5
    Rep Power
    0
    troycawley

    Thanks for repying,

    But the form is intended to get some information form the external server database, so a direct url can't be used...

    aclips

  6. #6
    satis's Avatar
    Join Date
    Oct 2002
    Location
    Dallas
    Posts
    2,914
    Rep Power
    21
    a few things...

    the targeting a form into an iframe works. Here's some example code:
    PHP Code:
    <form action='http://cnn.com' target='test'>
    <
    input type='submit'>
    </
    form>

    <
    iframe style='width: 150px; border: 1px solid #000000;' name='test'></iframe
    In your last post you state "But the form is intended to get some information form the external server database, so a direct url can't be used...", but that's exactly what you're doing. When you submit the form, the client is sending a GET request directly to the external server.

  7. #7
    Registered
    Join Date
    Oct 2007
    Location
    Portugal
    Posts
    5
    Rep Power
    0
    Quote Originally Posted by satis View Post
    a few things...

    the targeting a form into an iframe works. Here's some example code:
    PHP Code:
    <form action='http://cnn.com' target='test'>
    <
    input type='submit'>
    </
    form>

    <
    iframe style='width: 150px; border: 1px solid #000000;' name='test'></iframe

    Quote Originally Posted by satis View Post
    In your last post you state "But the form is intended to get some information form the external server database, so a direct url can't be used...", but that's exactly what you're doing. When you submit the form, the client is sending a GET request directly to the external server.
    Sure but how can i know the exact url, if the form can get 10 diferent informations from the external server, or can just get 1, example:

    the webpag: www.bestsilvercoast.com
    the quick search form is were the client selects what we wants to look for, then the result should be presented to a 1by1 iframe:

    All options form request:
    A few options selected:
    This way i cant get a consistent url to directly post on the iframe, right?

    Thanks

    Aclips

  8. #8
    satis's Avatar
    Join Date
    Oct 2002
    Location
    Dallas
    Posts
    2,914
    Rep Power
    21
    I'm not really sure what you're trying to accomplish. Regarding the GET url you're trying to send to your iframe, that's the whole point of the form... ie
    PHP Code:
    <form action='http://paginas.imoguia.pt/constantinogomes/kitservidor/en/listagem.htm' target='test'>
    <
    input name="nat">
    <
    input name="typ">
    <
    input name="bus">...etc
    <input type='submit'>
    </
    form
    ...replacing your inputs with checkboxes or radio buttons or whatever else is appropriate. Then when the click submit the end user's GET requests gets sent directly from their PC to the destination url (ie, paginas.imoguia.pt). That page then opens in the iframe.

    What are you trying to do? Just give easy access to the page or are you trying to do something with?

  9. #9
    Registered
    Join Date
    Oct 2007
    Location
    Portugal
    Posts
    5
    Rep Power
    0
    Ok i'm following you.

    The present webpage bellongs to a real estate agency that uses an online company to host their publicity, like this:

    TopCasas -> is the Real estate company
    Imoguia -> is the hosting company that has a software online and offline to upload and update all the properties that Topcasas has to offer.

    Then they provide an "external" server that can be used to post the porperties from topcasas, with the external server kit i'm trying to build an website, that provides all the information and forms to search a specific property that is hosted on the Imoguia database. This way i intend to use a simplyfied from to provide clients a quick search for what they are looking for.

    So i need the result from the quick search form to be posted on a iframe that inicially is hidden (1by1) when the form options are choosed and the submition buttis is pressed.

    I hope you undersant my explanation, has my english is not that good.

    regards

    Aclips

  10. #10
    satis's Avatar
    Join Date
    Oct 2002
    Location
    Dallas
    Posts
    2,914
    Rep Power
    21
    ok...well, that code should work. You would need to add some javascript to your form that will resize your iframe when the form is submitted. Otherwise it'll always be 1px x 1px which kinda renders the iframe pointless. Or you could use javascript to dynamically create the iframe....or you could even use javascript to get the values of the form, open an asynchronous connection to the sight, then dynamically take the result and append it to your page.

    The last is probably the coolest but also takes the most work. The way you're doing it is probably the easiest.

    My recommendation is to start by making your iframe a decent size and just tuning your form until it does what you want it to do. Once you have it functional, then you can deal with making the iframe small to begin with and dynamically update when the form is submitted.

Posting Permissions

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