submit form in frame2 after submitting form in frame1

Discussion in 'JavaScript' started by Oreamnos, Mar 26, 2006.

  1. #1
    anyone know how i can submit a form in frame2 after submitting a form in frame1?

    i've been using the following code (and modifications of it) but it's not working at all:
    <script type="text/javascript">
    <!--
    function submitform()
    {
       parent.form2.submit();
       return true;
    }
    //-->
    </script>
    <form method="post" name="form1" onSubmit="return submitform();">
    field2: <input name="field2" value="<?php echo $_POST['field2']; ?>" type="text"><br />
    <input type="submit" name="submit" value="submit">
    </form>
    
    Code (markup):
    my other form is named form2 and holds the preceding code in an <iframe>.

    any help would be totally appreciated on this one as i've been struggling with this for a few days... :(

    thanks
    eric
     
    Oreamnos, Mar 26, 2006 IP
  2. Slapyo

    Slapyo Well-Known Member

    Messages:
    266
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    108
    #2
    Have you tried this.

    parent.otherframename.form2.submit();
    Code (markup):
     
    Slapyo, Mar 26, 2006 IP
  3. Oreamnos

    Oreamnos Well-Known Member

    Messages:
    154
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    101
    #3
    i'm not sure what to call the "frame" that holds the iframe... my iframe is just embedded in a standard page, what would the name of that page be?
     
    Oreamnos, Mar 26, 2006 IP
  4. Slapyo

    Slapyo Well-Known Member

    Messages:
    266
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    108
    #4
    So you have a page which loads 2 frames. Then in one of those frames is an iframe with some javascript and a form you are trying to submit?
    parent.otherframename.iframename.form2.submit();
    Code (markup):
     
    Slapyo, Mar 27, 2006 IP