Html表单执行两个动作? [英] Html form perform two actions?

查看:125
本文介绍了Html表单执行两个动作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

好的......我确定这已经在某个地方得到了解答,但我找不到它。所以,先谢谢你编写专家!



所以,我有一个HTML表单,其中包含一个引用formspree的动作。 formspree的一个缺点是无法根据输入到email字段的输入发送自动回复电子邮件。



如何才能提交表单formpree的表单并发送自动回复?以下是我的表格代码:



*********************

Ok...I'm sure this has been answered somewhere but I can't find it. So thanks in advance to you coding gurus!

So, I have an HTML form with an action referencing formspree. One of the shortcomings of formspree is the inability to send an auto reply email based on input put into the "email" field.

How can I get the form to submit the form to formspree and send an auto reply? Below is my code for the form:

*********************

<form action="https://formspree.io/xxxxxxxxxx@xxxx.com"  method="POST">   			
<label for="name">Name: <span class="required">*</span></label>
            <input type="text" id="name" Name="Name" value="" placeholder="John Doe" required="required" autofocus />
            <label for="email">Email Address: <span class="required">*</span></label>
            <input type="email" id="email" name="E-mail" value="" placeholder="johndoe@example.com" required="required" />
            <label for="telephone">Contact Number: </label>
            <input type="tel" id="Telephone" name="Telephone" value="" />
            <label for="contact">Preferred Contact Method: </label>
            <select id="contact" name="Preferred Contact Method:">
              <option value="email">Email</option>
              <option value="phone">Phone - During the Day</option>
              <option value="phone">Phone - In the Eveneing</option>
              <option value="phone">Phone - Anytime</option>
            </select>
            <label for="enquiry">Purpose: </label>
            <select id="enquiry" name="Reason:">
              <option value="general">General Info</option>
              <option value="offer">Introductory Offer</option>
              <option value="experienced">Experienced CrossFitter</option>
              <option value="feedback">Your Feedback</option>
            </select>
            <label for="message">Message: <span class="required">*</span></label>
            <textarea id="message" name="Message" placeholder="Your message must be greater than 20 charcters" required data-minlength="20"></textarea>
            <span id="loading"></span>
            <input type="submit" value="SUBMIT"  id="submit-button" />
            <p id="req-field-desc"><span class="required">*</span> indicates a required field</p>
</form> 



************************** *



我是什么尝试过:



研究和onclick但是因为提交的输入不是; ta按钮我不认为onclick工作


**************************

What I have tried:

Research and "onclick' but since the input for the submit isn;t a button I don;t think the onclick works

推荐答案

您不能使用HTML或JavaScript - 或Formspree执行此操作。如果您也使用服务器端语言(即ASP.NET或PHP),最好将操作设置为您自己服务器上的某些内容并从那里读取电子邮件地址并在那里发送电子邮件 - 但是当您使用formspree时,我认为你不使用服务器端语言。



但是,如果你不使用服务器端语言,还有其他选择:



  • 使用支持脚本的电子邮件客户端,编写处理来自表单的传入电子邮件的脚本,提取电子邮件地址和回复。您的计算机和客户端必须始终打开,否则您将无法立即回复。
  • 如果您不想使用邮件客户端,您可以选择一种编程语言编写一些与您的电子邮件地址的电子邮件服务器通信的软件(查看IMAP或POP3协议)并处理这样的电子邮件。这当然比电子邮件客户端脚本更难,因为您还必须处理电子邮件服务器通信。而且,您需要全天候运行才能保证即时回复。
You can't do this with HTML or JavaScript - or Formspree. If you use a server-side language (i.e. ASP.NET or PHP) as well, you better set the "action" to something on your own server and read the email address from there and send an email there - but as you use formspree, I don't think you use a server-side language.

However, there are alternatives if you don't use a server-side language:

  • Use an email client that supports scripting, write a script that handles incoming email from the form, extracts the email address, and replies. Your computer and client would have to be turned on all the time though, otherwise you wouldn't have instant replies.
  • If you don't want to use a mail client, you can pick a programming language to write some software that communicates with the email server of your email address (look into the IMAP or POP3 protocols) and process the emails like this. This is of course harder than email client scripting, because you also have to deal with the email server communication. And again, you need to have this running 24/7 to guarantee instant replies.


这篇关于Html表单执行两个动作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆