简体   繁体   English

Facebook App表单不会提交

[英]Facebook App form won't submit

Ok so I have this email sign up form that I use on my website. 好的,所以我有在网站上使用的此电子邮件注册表格。 I got the script directly from the email management system as they are the ones that process the form. 我直接从电子邮件管理系统获得了脚本,因为它们是处理表单的脚本。

I'm using it on my website and it works perfectly but when I try and run the same script in a Facebook App it fails to submit. 我正在我的网站上使用它,并且效果很好,但是当我尝试在Facebook App中运行相同的脚本时,它无法提交。 Actually that's not strictly true as it does pop up with the 'You need to agree to the terms...' if left unchecked but it doesn't get any further than that. 实际上,这并不是严格意义上的,因为如果未选中,它会弹出“您需要同意条款...”,但除此之外别无所求。

I've tested it in a browser and it works so I know there's nothing wrong with the code, I'm just baffled as to why it won't function in Facebook. 我已经在浏览器中对其进行了测试,并且可以正常工作,所以我知道代码没有什么问题,我对为什么它无法在Facebook中运行感到困惑。

Here is the script exactly how it appears on the page. 以下是该脚本在页面上的确切显示方式。

<form action="http://www.elabs12.com/functions/mailing_list.html" method="post" name="UPTml807" onSubmit="return (!(UPTvalidateform(document.UPTml807)));">
        <input type="hidden" name="submitaction" value="3">
        <input type="hidden" name="mlid" value="807">
        <input type="hidden" name="siteid" value="2012000210">
        <input type="hidden" name="tagtype" value="q2">
        <input type="hidden" name="demographics" value="1,2,-1,40836,37592">
        <input type="hidden" name="redirection" value="http://www.MYWEBISTE.com/WebContent/Promotions/PromotionsNewEmailThanks.htm">
        <input type="hidden" name="uredirection" value="http://">
        <input type="hidden" name="welcome" value="">
        <input type="hidden" name="double_optin" value="">
        <input type="hidden" name="append" value="on">
        <input type="hidden" name="update" value="on">
        <input type="hidden" name="activity" value="submit">

        <div class="textfield">
        <table border="0" cellspacing="0" cellpadding="5" width="100%">
  <tr>
    <td><span class="formText">Your First Name*</span><br/><input type="text" name="val_1" class="firstName" size="10" value="" /></td>
    <td><span class="formText">Your Last Name*</span><br/><input type="text" name="val_2" class="lastName" size="10" value="" /></td>
  </tr>
  <tr>
    <td colspan="2"><span class="formText">Your Email*</span><br/><input type='text' name='email' class="email" value=''  style='display:block'/></td>
    </tr>
  <tr>
    <td colspan="2"><span class="formText">Your Mobile Number</span><br/>
      <input type='text' name='val_3' class="mobile" value=''  style='display:block'/></td>
    </tr>
  <tr>
    <td><div style="text-align:left; margin:0 0 20px 0px"><input type="checkbox" id="val_37592" name="val_37592" style="width:20px; height:10px;">  
<span class="formText">I accept your Privacy Policy (below)*</span><br/><br/><span style="font-size:12px !important;" class="formText">*Required field</span></div></td>
    <td align="right"><input type="submit" name="submit" value="Submit" class="submitBTN" /></td>
  </tr>
</table>


</div>



<script language="Javascript">
function emailCheck (emailStr) {
var emailPat=/^(.+)@(.+)$/;
var specialChars="\\(\\)<>@,;:\\\\\\\"\\.\\[\\]";
var validChars="\[^\\s" + specialChars + "\]";
var quotedUser="(\"[^\"]*\")";
var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/;
var atom=validChars + '+';
var word="(" + atom + "|" + quotedUser + ")";
var userPat=new RegExp("^" + word + "(\\." + word + ")*$");
var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$");
var matchArray=emailStr.match(emailPat);
if (matchArray==null) {
    alert("Email address seems incorrect (check @ and .'s)");
    return false;
}
var user=matchArray[1];
var domain=matchArray[2];
if (user.match(userPat)==null) {
    alert("The username doesn't seem to be valid.");
    return false;
}
var IPArray=domain.match(ipDomainPat);
if (IPArray!=null) {
      for (var i=1;i<=4;i++) {
        if (IPArray[i]>255) {
            alert("Destination IP address is invalid!");
        return false;
        }
    }
    return true;
}
var domainArray=domain.match(domainPat);
if (domainArray==null) {
    alert("The domain name doesn't seem to be valid.");
    return false;
}
var atomPat=new RegExp(atom,"g");
var domArr=domain.match(atomPat);
var len=domArr.length;
if ((domArr[domArr.length-1] != "info") &&
    (domArr[domArr.length-1] != "name") &&
    (domArr[domArr.length-1] != "arpa") &&
    (domArr[domArr.length-1] != "coop") &&
    (domArr[domArr.length-1] != "aero")) {
        if (domArr[domArr.length-1].length<2 ||
            domArr[domArr.length-1].length>3) {
                alert("The address must end in a three-letter domain, or two letter country.");
                return false;
        }
}
if (len<2) {
   var errStr="This address is missing a hostname!";
   alert(errStr);
   return false;
}
return true;
}
function UPTvalidateform(thisform)
{
if (document.getElementById("val_37592").checked==false){alert("Please let us know you have read and agree to the Terms and Conditions of this email alert sign up"); return(true);}

if (thisform.val_1.value==""){   
alert("Please enter a value for First Name");
return(true);}if (thisform.val_2.value==""){   
alert("Please enter a value for Last Name");
return(true);}
    if (emailCheck(thisform.email.value)) 
    {   

        if ((document.getElementById('unsubscribe') 
            && document.getElementById('unsubscribe').checked) && (document.getElementById('showpopup') && document.getElementById('showpopup').value == "on")) {
        alert('Thank you, now you are unsubscribed!'); 
    }
    else if(( (document.getElementById('unsubscribe')
            && !document.getElementById('unsubscribe').checked) || (!document.getElementById('unsubscribe')) ) && (document.getElementById('showpopup') && document.getElementById('showpopup').value == "on")){
            alert('Thank you for signing up!');
        }
        return false;
    }
    else
    {
        return true;
    }
}

</script>

    </form>

I've tried removing the JS to see if Facebook was blocking it and I just get the same result. 我尝试删除JS,以查看Facebook是否阻止了它,但我得到的结果还是一样。 I've even tried submitting to a different URL but no luck. 我什至尝试提交到其他URL,但是没有运气。

Is there something I've missed/am I being blind? 有什么我想念的东西/我是盲人吗? Or maybe it's a deeper issue... 也许这是一个更深层次的问题...

Any help is much appreciated. 任何帮助深表感谢。

Thank you. 谢谢。

The url you submit to must be registred in the app details. 您提交的网址必须在应用程序详细信息中注册。 Try changing the app domains in facebook developers. 尝试在Facebook开发人员中更改应用程序域。

Further more if you're browsing facebook in secure mode (default setting) it will block all content from non-ssl urls. 此外,如果您以安全模式(默认设置)浏览Facebook,它将阻止来自非SSL网址的所有内容。 so http://www.elabs12.com/functions/mailing_list.html would have to be https://www.elabs12.com/functions/mailing_list.html 因此http://www.elabs12.com/functions/mailing_list.html必须是https://www.elabs12.com/functions/mailing_list.html

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

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