繁体   English   中英

重定向到 html 上的第三方网站提交并重置 html 表单

[英]Redirect to third party webiste on html submit and reset html form

我有一个 html 页面,我在其中为用户提供了一个注册表单,如下所示:

在此处输入图像描述

当用户单击提交按钮时,我希望用户使用表单变量作为查询参数重定向到https://domainname.com ,然后在 html 文件中重置表单。

但我只能将用户重定向到其他网站,但不能重置表单。

这是我的代码:

     <section class="green-bg">
            <div class="container wide">
                <div class="row joinnow-div" id="joinnow">
                <!-- Form styles-->
                        <h3>Join us today</h3>
                        <form action="https://domainname.com/" target="_blank" id="joinnow-form">
                            <label for="businessname">Your business's name</label>
                            <input type="text" id="businessname" name="businessname" placeholder="Business Name" required>

                            <label for="phonenumber">Contact number</label>
                            <input type="tel" id="phonenumber" name="phonenumber" placeholder="eg. 07700100100" required>

                            <label for="address">Your business's street address</label>
                            <textarea type="text" id="address" name="address" placeholder="eg. 123 Business street" required></textarea>

                            <label for="emailaddress">Email address</label>
                            <input type="email" id="emailaddress" name="emailaddress" placeholder="Eg. yourmail@email.com" required>

                            <a href="https://domainname.com/" target="_blank" >Already registered?</h3><br/><br/>
                            <input type="submit" value="Submit">                            
                        </form>
                <!-- -->
                </div>
            </div>
        </section>

当我单击提交按钮时,它会将用户重定向到https://domainname.com?businessname=&phonenumber=&email=&address=可以,但我想在重定向后重置表单。

任何想法我怎么能尝试这个?

好的,这有效:

<form action="" target="_blank" onsubmit=" setTimeout(() => this.reset())">
    <input name="hello">
    <input type="submit">
</form>

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM