[英]Colorbox + Form, Submit only working on Enter button (not onclick)
I integrated a popup upon landing on our page http://www.showstye.lu (best seen in an incognito window due to cookie reset). 登陆页面http://www.showstye.lu时,我集成了一个弹出窗口(由于Cookie重置,在隐身窗口中最佳)。 In this popup you have a newsletter signup form which is a copy of the one available in the footer.
在此弹出窗口中,您具有新闻通讯注册表单,该表单是页脚中可用表单的副本。
I had to duplicate css to adapt to the newsletter popup so that it styled correctly which is fine, I am using Colorbox for the popup itself. 我必须复制css来适应新闻通讯的弹出窗口,以便它的样式正确,这很好,我使用Colorbox作为弹出窗口本身。
Now, the form itself when I click on the submit button (S'Abonner) it doesn't trigger the submit correctly. 现在,当我单击“提交”按钮(S'Abonner)时,表单本身无法正确触发提交。 I always get a false return telling me to resubmit a new e-mail address.
我总是收到错误的回复,告诉我重新提交一个新的电子邮件地址。
However, the newsletter form itself works completely fine in the footer and ALSO when I use the keyboard stroke "Enter" instead of clicking on the submit button. 但是,当我使用键盘笔触“ Enter”而不是单击“提交”按钮时,新闻稿表单本身在页脚和ALSO中都可以正常使用。
I don't comprehend why one form works in the footer but the identical copy does not (only with Enter keystroke), I looked at the styling/JS/html of the form and it is identical across both. 我不理解为什么一个表单在页脚中起作用,但是同一个副本却不起作用(仅使用Enter键),我查看了表单的样式/ JS / html,并且两者之间都是相同的。
Any ideas how to resolve this so that the submit button works successfully? 有什么想法可以解决此问题,以便“提交”按钮成功工作吗?
<div style='display:none'>
<div id='subscribe_popup'>
<div id="spop_left">
<div id="spop_top"></div>
<div id="spop_sign">
<div class="popbox">
{% if theme.setting_newsletter %}
<form id="formNewsletter" action="{{ 'account/newsletter' | url }}" method="post">
<input type="hidden" name="key" value="{{ page.key }}" />
<input type="email" name="email" id="formNewsletterEmail" value="" placeholder="{{ 'E-mail' | t }}"/>
<a class="btn glyphicon glyphicon-send" href="#" onclick="$('#formNewsletter').submit(); return false;" title="{{ 'Subscribe' | t }}" {% if shop.language == 'de' %}style="padding: 0px 10px;"{% endif %}><span>{{ 'Subscribe' | t }}</span></a>
</form>
</div> {% endif %}
</div>
</div>
<div id="spop_right"></div>
</div>
</div>
<!-- END subscribe popup-->
Here is the JS behind it: 这是其背后的JS:
<script> // popup script
$("document").ready(function (){
// load the overlay
if (document.cookie.indexOf('visited=true') == -1) {
var fifteenDays = 1000*60*60*24*15;
var expires = new Date((new Date()).valueOf() + fifteenDays);
document.cookie = "visited=true;expires=" + expires.toUTCString();
$.colorbox({width:"553px", inline:true, href:"#subscribe_popup"});
}
$(".open_popup").colorbox({width:"553px", inline:true, href:"#subscribe_popup"});
});
</script>
好的,就是我将提交集成到超链接中,而不是使用简单的inputtype提交,击键显然是有效的,因为浏览器如何将击键输入自动识别为提交!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.