我正在使用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>
这是Facebook的错误吗?或者我做错了什么?
答案 0 :(得分:0)
你是使用iframe还是xfbml?此解决方案仅适用于xfblm !!
实际上只能在App-sites(apps.facebook.com / ...)中使用onvalidate =“validate”。 如果你在Facebook应用程序中使用它不起作用。