问题
I have a problem to validate my Facebook form. On custom input blur, I have the message
Permission denied to access property
and the validation doesn't occur.
This is my code:
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:fb="http://www.facebook.com/2008/fbml">
<head>
<title>Home</title>
</head>
<body>
<div id="fb-root"></div>
<script src="https://connect.facebook.net/en_US/all.js#appId=<?php echo FACEBOOK_APP_ID; ?>&xfbml=1"></script>
<fb:registration
fields='[
{"name":"name"},
{"name":"first_name"},
{"name":"last_name"},
{"name":"gender"},
{"name":"company", "description":"Company", "type":"text"},
{"name":"address", "description":"Address", "type":"text"},
{"name":"zip_code", "description":"Zip Code", "type":"text"},
{"name":"city", "description":"City", "type":"typeahead", "categories":["city"]},
{"name":"phone", "description":"Phone","type":"text"},
{"name":"mobile_phone", "description":"Mobile Phone","type":"text"},
{"name":"email"},
{"name":"optin", "description":"I may receive communications from Fanpage Booster", "type":"checkbox", "default":"unchecked"},
{"name":"captcha"}
]'
redirect-uri="recup.php" width="530" fb_only="true" onvalidate="validate" >
</fb:registration>
<script>
function validate(form) {
errors = {};
if (form.company == '') {
errors.company = "Company can't be empty !";
}
if (form.address == '') {
errors.address = "Address can't be empty !";
}
if (form.zip_code == '') {
errors.zip_code = "Zip Code can't be empty !";
}
return errors;
}
</script>
</body>
I took a look at some tutorials on Facebook registration, at Facebook documentation, and questions on this site, but I don't see solutions or a similar problem ...
How do I fix this problem?
回答1:
I wasn't able to reproduce that error. I did have to make sure redirect-uri was set to an absolute URL, add a close html tag, and change the script reference to be protocol less like:
<script src="//connect.facebook.net/en_US/all.js#appId=APPID&xfbml=1"></script>
The Facebook validation doesn't work on blur, it works once the form gets submitted. Where were you adding an onblur event?
回答2:
I faced the same situation and ended up fixing it by using a secure site (HTTPS). It won't work in HTTP even though I specified a protocol-less script reference.
来源:https://stackoverflow.com/questions/7206587/facebook-registration-validation-permission-denied-to-access-property-arbiter