Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/facebook/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Facebook注册插件未验证复选框字段_Facebook - Fatal编程技术网

Facebook注册插件未验证复选框字段

Facebook注册插件未验证复选框字段,facebook,Facebook,我正在使用Facebook注册插件。我还添加了一个复选框字段,在用户注册之前需要对其进行验证 它显示了错误消息,但显示了验证错误。它还允许用户注册到我的站点 这是我的代码: <fb:registration fields="[ {'name':'name'}, {'name':'email'}, {'name':'legal ', 'description':'I accept the legal terms', 'type':'checkbox'

我正在使用Facebook注册插件。我还添加了一个复选框字段,在用户注册之前需要对其进行验证

它显示了错误消息,但显示了验证错误。它还允许用户注册到我的站点

这是我的代码:

<fb:registration 
     fields="[
     {'name':'name'},
     {'name':'email'},
     {'name':'legal ', 'description':'I accept the legal terms', 'type':'checkbox',  'default':'checked'}
     ]" 
     redirect-uri="http://www.mysite.com/page"
     width="710"
     onvalidate="validate">
 </fb:registration>

 <script> 
     function validate(form) {
         errors = {};
         if (form.name === "") {
           errors.name = "You must fill your name";
         }

         if (form.email === "") {
           errors.email = "You must fill your email";
         }

         if (!form.legal) {
           errors.legal = "You have to accept the legal terms";
         }

         return errors;
     }
 </script> 

函数验证(表单){
错误={};
如果(form.name==“”){
errors.name=“您必须填写您的姓名”;
}
如果(form.email==“”){
errors.email=“您必须填写您的电子邮件”;
}
如果(!form.legal){
errors.legal=“您必须接受法律条款”;
}
返回错误;
}
这是Facebook的bug吗?还是我做错了什么

  • 您使用的是iframe还是xfbml?此解决方案仅适用于xfblm

  • 实际使用onvalidate=“validate”只能在应用程序网站(apps.facebook.com/…)中使用。 如果你在facebook应用程序中使用它,它将不起作用