执行行动和逾越节价值观的形式

发布于 2024-12-22 03:48:16 字数 3546 浏览 0 评论 0 原文

嗨,我基本上有一个表单,有两个文本框,它们会将数据发送回谷歌电子表格,因为我已将我的表单附加到谷歌表单,如果你知道如何做到这一点,那么就可以了,如果不知道,你可以采取看这里 http://www.morningcopy.com.au/tutorials/how-to-style-google-forms/lets 调用它们,

<form action="LINK TO GOOGLE SPREAD SHEET LINK" method="post">
<input type="text" id="tb1" name="tb1"/>
<input type="text" id="tb2" name="tb2"/>
<input type="submit" value="submit"/>
</form>

所以我的问题是一旦提交数据我想要获取要传递到下一页的 textbox2.value 我们将其称为 page2.html,因此之前的 tb2.value 会传递到 page2.html textbox1.value。我还知道如何导航到下一页,所以这不是问题,问题是如何从 tb2 获取值并同时提交表单。 TKS 一直在努力完成这项工作。

<form action="LINK TO GOOGLE SPREAD SHEET LINK" method="post">
<input type="text" id="tb1" name="tb1"/>
<input type="text" id="tb2" name="tb2"/>
<input type="submit" value="submit"/>


</form>

SO I HAVE MODIFIED TO LOOK AS BELOW 
For the first page is this its name is Testhtml.html


    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title>TEsthtml.html</title>
    </head>

    <body>

    <iframe name="response_iframe" id="hidden_iframe" style="display:none;" onload="if(submitted){window.location='simple.html';}"></iframe>
    <form action="https://docs.google.com/spreadsheet/formResponse?formkey=dDN5RE9ueU9HRGdQYzlJYWhrRUY1UEE6MQ&ifq" target="response_iframe" onSubmit="submitted=true;" method="POST">
    <label  for="entry_0">Type ur name</label>
    <input type="text" name="entry.0.single" value=""  id="entry_0">
    <br> 
    <label  for="entry_1">ur pets name
    </label>
    <label  for="entry_1">type something</label>
    <input type="text" name="entry.1.single" value=""  id="entry_1">
    <br>
    <input type="submit" name="submit" value="Submit">
    <script type="text/javascript">
    $(document).ready(function () {
        $('commentForm').submit(function () {
            var tb2_val = $('input#entry_1', $(this)).val();
            // do something with tb2_val
    localStorage.setItem('hpnumber', tb2_val);
            // return false; // uncommenting this will prevent the submit action
        });
    });

    </script>
    </form>
    </body>
    </html>

第二页是这个,它的名称是 simple.html

 <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title>Simple HTML</title>
    <script type="text/javascript">
    $(document).ready(function () {
        var thevalue = localStorage.getItem("hpnumber")
        $('form').find('input#tb1').val(thevalue);
    });

    </script>
    </head>

    <body>
    <script type="text/javascript">
    $(document).ready(function () {
        var thevalue = localStorage.getItem("hpnumber")
        $('form').find('input#tb1').val(thevalue);
    });

    </script>
    <input id="tb1" name="tb1" type="text"/>


    </body>
    </html>

,但在数据能够提交时仍然无法工作,第二页 simple.html 正在打开,文本框值设置为空白。.请帮助解决此问题。顺便说一句,您可以知道,每当您按下提交按钮时,Google 电子表格中的数据就会更新,电子表格将在这里公开。https://docs.google.com/spreadsheet/ccc?key=0AqUqEITRLZjYdDN5RE9ueU9HRGdQYzlJYWhrRUY1UEE

Hi i basically have a form that has a two textboxes which will send the data back to the google spreadsheet, as i have attached my form to the google form, if u know how to do this then its ok, if not u can take a look here http://www.morningcopy.com.au/tutorials/how-to-style-google-forms/lets call them,

<form action="LINK TO GOOGLE SPREAD SHEET LINK" method="post">
<input type="text" id="tb1" name="tb1"/>
<input type="text" id="tb2" name="tb2"/>
<input type="submit" value="submit"/>
</form>

So my question is once the data is submitted I want to get the textbox2.value to be passed over to the next page lets call it page2.html, so the previous tb2.value is passed over to page2.html textbox1.value. I also know how to navigate to the next page so that is not the issue the issue is how to get the value from tb2 and also submit the form at the same time. TKS been struggling to get this done.

<form action="LINK TO GOOGLE SPREAD SHEET LINK" method="post">
<input type="text" id="tb1" name="tb1"/>
<input type="text" id="tb2" name="tb2"/>
<input type="submit" value="submit"/>


</form>

SO I HAVE MODIFIED TO LOOK AS BELOW 
For the first page is this its name is Testhtml.html


    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title>TEsthtml.html</title>
    </head>

    <body>

    <iframe name="response_iframe" id="hidden_iframe" style="display:none;" onload="if(submitted){window.location='simple.html';}"></iframe>
    <form action="https://docs.google.com/spreadsheet/formResponse?formkey=dDN5RE9ueU9HRGdQYzlJYWhrRUY1UEE6MQ&ifq" target="response_iframe" onSubmit="submitted=true;" method="POST">
    <label  for="entry_0">Type ur name</label>
    <input type="text" name="entry.0.single" value=""  id="entry_0">
    <br> 
    <label  for="entry_1">ur pets name
    </label>
    <label  for="entry_1">type something</label>
    <input type="text" name="entry.1.single" value=""  id="entry_1">
    <br>
    <input type="submit" name="submit" value="Submit">
    <script type="text/javascript">
    $(document).ready(function () {
        $('commentForm').submit(function () {
            var tb2_val = $('input#entry_1', $(this)).val();
            // do something with tb2_val
    localStorage.setItem('hpnumber', tb2_val);
            // return false; // uncommenting this will prevent the submit action
        });
    });

    </script>
    </form>
    </body>
    </html>

THE SECOND PAGE IS THIS its name is simple.html

 <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title>Simple HTML</title>
    <script type="text/javascript">
    $(document).ready(function () {
        var thevalue = localStorage.getItem("hpnumber")
        $('form').find('input#tb1').val(thevalue);
    });

    </script>
    </head>

    <body>
    <script type="text/javascript">
    $(document).ready(function () {
        var thevalue = localStorage.getItem("hpnumber")
        $('form').find('input#tb1').val(thevalue);
    });

    </script>
    <input id="tb1" name="tb1" type="text"/>


    </body>
    </html>

but still not working while the data is able to submit and the second page the simple.html is opening up with the textbox value set to nothing just blank..please help with this tks. BTW u can c that the data is being update in the google spreadsheet whenever u press submit button, the spreadsheet is made public here you go.. https://docs.google.com/spreadsheet/ccc?key=0AqUqEITRLZjYdDN5RE9ueU9HRGdQYzlJYWhrRUY1UEE

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

剩一世无双 2024-12-29 03:48:16

要在提交时获取表单值,只需使用

$(document).ready(function () {
    $('form').submit(function () {
        var tb2_val = $('input#tb2', $(this)).val();
        // do something with tb2_val

        // return false; // uncommenting this will prevent the submit action
    });
});

至于在页面之间传递值,您必须确定如何处理它(cookie、url 参数、存储到数据库/从数据库检索、html5 本地存储等) 。一旦你确定了你的方法,抓住价值并做

$(document).ready(function () {
    var thevalue = ///
    $('form').find('input#tb1').val(thevalue);
});

To get the form values on submit, just use

$(document).ready(function () {
    $('form').submit(function () {
        var tb2_val = $('input#tb2', $(this)).val();
        // do something with tb2_val

        // return false; // uncommenting this will prevent the submit action
    });
});

As far as passing values between pages, you'll have to determine how you'll handle that (cookies, url parameters, store to db/retrieve from db, html5 local storage, etc). Once you determine your method, grab the value and do

$(document).ready(function () {
    var thevalue = ///
    $('form').find('input#tb1').val(thevalue);
});
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文