Results 1 to 3 of 3

Thread: Passing variables from an html form on one page to an iframe on another page

  1. #1
    Join Date
    Nov 2008

    Question Passing variables from an html form on one page to an iframe on another page

    I have a form on one page (parent) with date, name, organization, email, and phone as text boxes, and one checkbox to except terms. All of the form fields can be addressed as document.formname.name.value. I have the form page working with "on submit" the form checks the data and browser type. If all is good it will send the data. I originally had this type of form submit to e-mail, but this one, I want to submit to another page with an iframe that has a google table embeded that I want to have the information to append after each submit. I have done passing variables before, but now like this, so I started with the code that I had from another project and changed some things from reading differnet forums, but it still isn't working. So, before I make too much of a mess here is what I have currently. What can I do to make this work.

    Parent (form):

    <script type ="text/javascript">

    <!-- hide

    function init() { window.parent.setUpFrame(); return true; }

    // -->


    <body onload="init();">

    <form method="get" action="myPage_Table.html" enctype="text/plain" onsubmit="return (checkdata() && BrowserDetect.function())" NAME="formname" onkeydown="if ((event.which && event.which == 13) || (event.keyCode && event.keyCode == 13)) {document.formname.send;return false;} else return true;">

    At this point my submit is working, except I am not sure if the variable are passing.

    Child (iframe):


    <script type="text/javascript">
    String.prototype.parsePairs = function () // parse delimited string of name/value pairs
    if (this.length == 0) return null; // return null for zero-length string
    var p_delim = (arguments[0]) ? arguments[0] : '&'; // set default pair delimiter
    var n_delim = (arguments[1]) ? arguments[1] : '='; // set default name delimiter
    var items = this.split(p_delim); // split argument string into an array
    var x, len = items.length; // get number of name/value pairs
    for (x=0; x<len; ++x) // loop on name/value pairs

    items[x] = items[x].split(n_delim); // split them and re-add to array
    items[x][0] = unescape(items[x][0].replace(/\+/g,' ')).trimEnds(); // massage and trim name value
    items[x][1] = (items[x][1]) ? unescape(items[x][1].replace(/\+/g,' ')).trimEnds() : ""; // massage

    and trim data value
    if (items[x][0].length > 0) { // add hash entry, also
    if (typeof items[items[x][0]] == 'undefined') {
    items[items[x][0]] = items[x][1];
    } else { // use array for duplicate

    hash entries
    if (typeof items[items[x][0]] != 'object') {
    items[items[x][0]] = new Array(items[items[x][0]]);
    } // end loop
    return items;
    String.prototype.trimEnds = function () // trim white-space off both ends of object string
    return this.replace(/(^\s+)|(\s+$)/g, ''); // return trimmed string

    <script> // reading the variable
    function setUpFrame() {
    var frame = window.frames['frameId'];

    <script type="text/javascript"> / / moving the variables to the table
    var $_GET = top.location.search.substr(1).parsePairs();
    frame.Date.value = $_GET[parent.document.formname.date.value];
    frame.Name.value = $_GET[parent.document.formname.name.value];
    frame.Organization.value = $_GET[parent.formname.disclaimer.org.value];
    frame.E-mail.value = $_GET[parent.document.formname.email.value];
    frame.Phone.value = $_GET[parent.document.formname.phone.value];
    frame.Accept.value = $_GET[parent.document.formname.accept.value];

    <iframe id="frameId" width='700' height='400' frameborder='0' src='https://docs.google.com/spreadsheet/pub?

    key=(table info)=true&gid=0&output=html&widget=true'></iframe>

  2. #2
    Join Date
    Nov 2008

    Unhappy I really need help on passing variables to an iframe spreadsheet

    This is really holding up the rest of the project. I can't get any of the suggestions to work from searching the internet. I came across this website and remembered I received go help about 5 years ago. The passing of the variables are similar from what I was asking before, but the difference is I am going from the form page to a page with as iframe spreadsheet, So if there is anyone who can help me with this would be appreciated.

  3. #3
    Join Date
    Nov 2008

    Post I need help

    For some reason, I can't edit my original post in this thread. All of the posts have been me, and I was going to try to reword, or fix it to see if I get help for my original question "Passing variable from an html form on one page to an iframe on another page. I get a log of hits, but no replies. I am not sure if the can be done or not, or if I need do what I need to do another way.

    What I need to do is put the information from the form into a table that will not be seen on the page and a download will begin because to get to this page, the terms need to be accepted on the form. I have the first part working, but I need the information to be appened to the table, before the download can take place.

    So, I main question: Can you Pass variable from an html form on one page to an iframe table on another page - if so, how can I do this. The code that I have from search around is in my original post.

    Thak you

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

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