3

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.

Ayush
  • 41,754
  • 51
  • 164
  • 239

2 Answers2

2

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 = ...

bkaid
  • 51,465
  • 22
  • 112
  • 128
  • oh, yes....it should be errors.emailEdu. That's definitely one issue. However, the alert won't fire so I suspect its not entering the JS function at all. I'll use the chrome debugging tool to see where I'm going wrong – Ayush Aug 26 '11 at 04:57
2

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.

Dave
  • 3,171
  • 1
  • 25
  • 23