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 6 of 6
  1. #1
    New Coder
    Join Date
    Jun 2004
    Posts
    14
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Post to an iFrame

    Hi:

    How can I extend this so that it posts the data from these 2 fields to an iframe,
    and what code do I need in the iframe to capture the data and present it in 2 fields?

    On the sending page, I have


    <script type="text/javascript">
    function passValue() {
    var ddl = document.getElementById("ddlName");
    var index = ddl.selectedIndex;
    document.getElementById("txtValue").value = ddl.value;
    document.getElementById("txtName").value = ddl.options[index].text;
    }
    </script>



    <iframe ID="first_iframe" src="http://xxx.net/iPage.html" width="600" height="400">
    </iframe>


    sample code appreciated. Thanks

  • #2
    Regular Coder
    Join Date
    Feb 2010
    Posts
    104
    Thanks
    5
    Thanked 3 Times in 3 Posts
    Code:
    <form target="first_iframe" action=""http://xxx.net/iPage.html">
    //your inputs here
    </form>
    Code:
    <iframe ID="first_iframe" width="600" height="400"> 
    </iframe>

  • #3
    New Coder
    Join Date
    Jun 2004
    Posts
    14
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Thanks for your effort;
    The form is not being submitted by a submit button. The function is the result of a SELECT as part of a Listbox.

    What I'm looking for is the correct code to extend the function to include the post to the iframe.

  • #4
    New Coder
    Join Date
    Jun 2004
    Posts
    14
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Got it to work using

    document.getElementById("iframe").contentDocument.getElementById("txtValue").value = ddl.value;

    Problem with Firefox. Somehow, it wouldn't work there.

    Thanks anyway..

  • #5
    Regular Coder
    Join Date
    Feb 2010
    Posts
    104
    Thanks
    5
    Thanked 3 Times in 3 Posts
    well to submit a form with JavaScript you have to use:

    Code:
        document.forms['form1'].submit();

  • Users who have thanked semiSkim for this post:

    simora (08-01-2010)

  • #6
    New Coder
    Join Date
    Jun 2004
    Posts
    14
    Thanks
    1
    Thanked 0 Times in 0 Posts
    semiSkim :

    You are correct. Its my vocabulary.
    I'm just selecting a value and passing it to input boxes and the iframe. I'm not actually submitting the values somewhere else.

    You were a great help. Thanks


  •  

    Posting Permissions

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