【发布时间】:2021-06-21 19:31:28
【问题描述】:
我需要你的帮助。 由于复选框选择,我想重定向到特定页面。表单已正确传输,但提交后未重定向到相应页面。我已将 Javascript 代码直接输入到 Contactform 7 中。(见图 1)您能帮帮我吗?
Contactform 7 简码和 Javascript:
[checkbox Auswahl id:eauswahl use_label_element default:0 "50€" "100€" "200€" "500€"]
<script>
document.addEventListener( 'wpcf7mailsent', function( event ) {
if ( '2539' == event.detail.contactFormId ) {
var aAuswahl = document.getElementById("eauswahl").value;
if (aAuswahl == "50€") {
location = 'http://localhost/dwp/danke1/';
} if else (aAuswahl == "100€") {
location = 'http://localhost/dwp/danke2/';
} if else (aAuswahl == "200€") {
location = 'http://localhost/dwp/danke3/';
} if else (aAuswahl == "500€") {
location = 'http://localhost/dwp/danke4/';
}
}
}, false )
</script>
【问题讨论】: