开发者

Can't get FB Registration Client side validation to work

开发者 https://www.devze.com 2023-03-30 17:07 出处:网络
I\'m following the instructions given on FB Developer, but I just can\'t get client side verification to work on my registration form.

I'm following the instructions given on FB Developer, but I just can't get client side verification to work on my registration form.

This code block is present in the body of my page:

    <script src="http://connect.facebook.net/en_US/all.js#appId=000000000&xfbml=1"></script>                                
   <fb:registration
      fields="[{'name':'name'},{'name':'emailEdu','description':'Your .edu Email','type':'text'}]"
      redirect-uri="http:/开发者_运维问答/www.lazydragonbooks.com"
      onvalidate="validate">
  </fb:registration>
  <script> 
    function validate(form) 
    {
      errors = {};
      if (form.emailEdu !== "foo") 
      {
        errors.foo = "You didn't type foo";
      }                               
      return errors;
    }
</script>           

EDIT:

I placed alert('foo') as the first line in the validate function but don't get the alert so it seems the function does not get called.


Check the Chrome debugging tools console errors for a javascript error. I am guessing something is failing that is causing it not to validate properly. Also, the line should be errors.emailEdu = "You didn't type foo"; not errors.foo = ...


I had the same problem while running the code on my local dev server. As soon as I ran the code at the domain URL registered for my Facebook app, it all worked fine.

That also fixed a problem where a weird 3 bar progress indicator was persisting on top of the registration form.

0

精彩评论

暂无评论...
验证码 换一张
取 消