Posting Data Between Frames

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Raffi

    Posting Data Between Frames

    I'm developing an application where the main page has an iframe that
    contains the form. The "Submit" button is located on the main page (not
    the iframe). Is it possible to get the form data from the iframe when
    the "Submit" button is pressed in the main browser page?

    Thanks,
    Raffi

  • Erwin Moller

    #2
    Re: Posting Data Between Frames

    Raffi wrote:
    [color=blue]
    > I'm developing an application where the main page has an iframe that
    > contains the form. The "Submit" button is located on the main page (not
    > the iframe). Is it possible to get the form data from the iframe when
    > the "Submit" button is pressed in the main browser page?
    >
    > Thanks,
    > Raffi[/color]

    Yes, easy enough with Javascript.
    Without Javascript, things get a lot more complicated (and I will not
    discuss them here.)

    Try reposting your question in comp.lang.javas cript for detailed
    description.

    The idea is:
    - Add a function to the event pressing the submitbutton.
    (eg make it a button, and add onClick, or use onSubmit)
    - read all the values from the form
    val1 = document.forms. myinnerframefor m.firstname.val ue;
    val2 = document.forms. myinnerframefor m.street.value;
    etc.

    Now call a function in your other frame (mainpage)
    parent.frames.m ainwindow.getTh is(val1,val2);

    But it has nothing to do with PHP.

    Regards,
    Erwin Moller

    Comment

    • Colin McKinnon

      #3
      Re: Posting Data Between Frames

      Raffi wrote:
      [color=blue]
      > I'm developing an application where the main page has an iframe that
      > contains the form. The "Submit" button is located on the main page (not
      > the iframe). Is it possible to get the form data from the iframe when
      > the "Submit" button is pressed in the main browser page?
      >
      > Thanks,
      > Raffi[/color]

      Yes - go ask the same question on a javascript group.

      C.

      Comment

      • Raffi

        #4
        Re: Posting Data Between Frames

        Thanks for your suggestions. I ended up using CSS (the application only
        allows access with MSIE 5+) and sidestepped the tedious cross-frame
        scripting.

        Here's the code for anyone interested:

        <style type="text/css">
        <div.scroll {
        height: 100px;
        width: 300px;
        overflow: auto;
        border: 2px solid #0000ff;
        background-color: #ffffff;
        padding: 8px;}
        </style>
        <html><body>
        <h4>Paint Supply Order Form</h4>
        <form action="index.p hp" method="post">
        <div class="scroll">
        Item:
        <select name="item">
        <option>Paint </option>
        <option>Brushes </option>
        <option>Erasers </option>
        </select>
        <br><br>
        Quantity:
        <input name="quantity" type="text" />
        <br><br>
        Color:
        <input name="color" type="text" />
        <br><br>
        Weight:
        <input name="weight" type="text" />
        <br><br>
        Location:
        <input name="location" type="text" />
        </div>
        <br><br>
        <input type="submit" name="submit" value="Submit">
        </form>

        Comment

        • Ramon

          #5
          Re: Posting Data Between Frames

          All of the suggestions on this topic are silly. If I needed to pass data
          between frames I would just store that data in $_SESSION. And... now you
          better sit down for this... not only will you be able to access data in
          different frames, you can also access the same data in DIFFERENT BROWSER
          WINDOWS (concurrent).

          *SHOCK HORROR*

          Anyway hope that helps.

          D


          Raffi wrote:[color=blue]
          > Thanks for your suggestions. I ended up using CSS (the application only
          > allows access with MSIE 5+) and sidestepped the tedious cross-frame
          > scripting.
          >
          > Here's the code for anyone interested:
          >
          > <style type="text/css">
          > <div.scroll {
          > height: 100px;
          > width: 300px;
          > overflow: auto;
          > border: 2px solid #0000ff;
          > background-color: #ffffff;
          > padding: 8px;}
          > </style>
          > <html><body>
          > <h4>Paint Supply Order Form</h4>
          > <form action="index.p hp" method="post">
          > <div class="scroll">
          > Item:
          > <select name="item">
          > <option>Paint </option>
          > <option>Brushes </option>
          > <option>Erasers </option>
          > </select>
          > <br><br>
          > Quantity:
          > <input name="quantity" type="text" />
          > <br><br>
          > Color:
          > <input name="color" type="text" />
          > <br><br>
          > Weight:
          > <input name="weight" type="text" />
          > <br><br>
          > Location:
          > <input name="location" type="text" />
          > </div>
          > <br><br>
          > <input type="submit" name="submit" value="Submit">
          > </form>
          >[/color]

          Comment

          Working...