Tôi đã truy cập trang web của mình trên Dịch vụ trang Github. Tôi đang cố triển khai biểu mẫu liên hệ miễn phí FormSpree nhưng sau khi bạn gửi biểu mẫu, nó chuyển hướng bạn đến một trang web khác. Một cái gì đó tôi muốn tránh. Vì vậy, tôi tìm kiếm nó trên internet và tất nhiên những người khác muốn loại bỏ nó quá (tôi bỏ qua email của tôi trong hình dưới đây).Làm cách nào để di chuyển trên FormSpree?
Đây là hình thức tôi đã ở trên nhưng nó không thực sự làm việc ở tất cả. Nó làm việc trước khi tôi cố gắng để fiddle với nó mặc dù.
Dưới đây là những gì các hình thức trông giống như theo mặc định từ FormSpree:
<form action="//formspree.io/[email protected]"
method="POST">
<input type="text" name="name">
<input type="email" name="_replyto">
<input type="submit" value="Send">
</form>
Đây là phiên bản của tôi (mà làm việc tốt trước khi tôi cố gắng để có được xung quanh redirect)
<div class=modal-body style="background-color: #454545">
<p>Please use the form below to contact us regarding feedback or any questions you may have!
We will never use the information given below to spam you and we will never pass on your
information to a 3rd party.</p>
<p>As we are using <a target="_blank" href="http://formspree.io">FormSpree</a> for this form
please consult their privacy policy for any questions regarding this matter.</p>
<form id="contactform" method="POST">
<div class="form-group">
<div class="input-group">
<span class="input-group-addon">Name</span>
<input name="form-name-input" type="text" name="name" class="form-control" required>
</div>
<div class="input-group">
<span class="input-group-addon">Email</span>
<input name="form-email-input" type="email" name="_replyto" class="form-control" required>
</div>
<div class="input-group">
<span class="input-group-addon">Subject</span>
<input name="form-subject-input" type="text" name="subject" class="form-control" required>
</div>
<div class="input-group">
<span class="input-group-addon">Description</span>
<textarea name="form-description-input" name="description" class="form-control" rows="4" cols="60" required></textarea>
</div>
<input type="text" name="_gotcha" style="display:none" />
<input class="btn btn-success" data-dismiss="modal" type="submit" id="form-submit-btn" value="Submit">
<input type="hidden" name="_next" value="http://www.dynamicrealities.net" onclick="FormSentConfirmation()"/>
</div>
<script>
var contactform = document.getElementById('contactform');
contactform.setAttribute('action', '//formspree.io/' + '[email protected]');
</script>
</form>
</div>
<div class="modal-footer" style="background-color: #333333">
<button class="btn btn-danger btn-bg" data-dismiss="modal" type="button" id="form-dismiss-btn" onclick="">Close</button>
</div>
Và khi tôi hãy gọi _next
Tôi muốn nó thực hiện cảnh báo sau:
function FormSentConfirmation() {
alert('Thanks for the email, we\'ll be in touch promptly.');
}
Wh vi Tôi nhấn nút Gửi, tất cả những gì xảy ra là biểu mẫu biến mất nhưng tôi không nhận được bất kỳ email nào. Tôi có lẽ chỉ làm điều này sai vì tôi khá mới vẫn còn HTML/JavaScript.
Tôi không biết FormSpree, nhưng bạn sẽ có thể kiểm tra xem trang được chuyển hướng, sau đó 'return false; 'và bạn nên có tốt để đi. – MortenMoulder
Tôi đã thêm biểu mẫu chuẩn mà họ cung cấp cho bạn làm ví dụ. Miễn là bạn đặt nó vào cấu trúc đó và gọi phương thức 'action =" // formspree.io/[email protected] " =" POST "trên biểu mẫu, FormSpree sẽ thực hiện phần còn lại. – OmniOwl
Kiểm tra www.enformed.io, hoạt động giống như formspree nhưng có chuyển hướng ra khỏi hộp – Ivangrx