Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8770949
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T17:39:53+00:00 2026-06-13T17:39:53+00:00

I am using a custom field in my Facebook registration plugin and need to

  • 0

I am using a custom field in my Facebook registration plugin and need to validate a zipcode field that returns a boolean value, somehow because of this inner function:

    geocoder.geocode({ address: address }, function (results, status) {
}

I am not able to return a value to my addExist variable and it always returns ‘Undefined’. Can anyone help? Thanks.

<fb:registration redirect_uri="http://localhost:40153/Account/RegisterDestination.aspx" 
     fields='[
       {"name":"name"},
       {"name":"gender"},
       {"name":"email"},
       {"name":"birthday"},
       {"name":"password"},
       {"name":"zip","description":"Postal Code","type":"text"}]'
       onvalidate="validate"></fb:registration>

       function validate(form) {
            errors = {};
            if (form.zip !== "") {

                var addExist = calculateCoordinates(form.zip.toString());
                // alert(addExist); 
                if (!addExist) {
                    errors.zip = "Cannot locate address";
                }
            }
            return errors;
        }

        function calculateCoordinates(zip) {

            var txtPostcode = zip;
            // var address = txtAddress1.value + ', ';
            // address += txtAddress2.value + ', ';
            // address += txtTown.value + ', ';
            var address = txtPostcode;
            // address += txtCountry.value;

            var geocoder;
            geocoder = new google.maps.Geocoder();
            geocoder.geocode({ address: address }, function (results, status) {
                if (status == google.maps.GeocoderStatus.OK) {
                    var location = results[0].geometry.location;
                    var litLatClientId = document.getElementById("<%=litLat %>");
                    var litLongClientId = document.getElementById("<%=litLong %>");

                    $("#" + litLatClientId).val(location.lat());
                    $("#" + litLongClientId).val(location.lng());

                    // Successfully reach here but the bool variable 'addExist' value gets an 'Undefined' value.

                    return true;
                }
                else
                return false;
            });
        } 
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T17:39:54+00:00Added an answer on June 13, 2026 at 5:39 pm

    calculateCoordinates is using geocode, which is an asynchronous function. It therefore follows that it must itself be used asynchronously in order to ‘return’ any data from the inner asynchronously function. This is done by using the callback pattern.

    Unfortunately, you are using it synchronously, and the registration plugin also expect validate to be synchronously. There is therefor essentially no way of making this work.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there any way using the facebook registration plugin custom fields, to make them
I am using the jquery validate plugin, in combination with some custom field types
I'm using custom radiobuttons with a SQLFORM as shown below: def radioboxes(field,value): items=[DIV(name,INPUT(_type='radio',_value=key,_name=field.name,value=value), _class='radio')
I'm using the Facebook Registration Plugin and it seems to have stopped working, but
I am using Wordpress Custom Field Template Plugin - http://wordpress.org/extend/plugins/custom-field-template/ I create some File
I'm using this codes for listing custom field values into drop-down list element on
I am using the Advanced Custom Fields wordpress plugin and I am outputting the
I am using a custom post type in my wordpress theme, and I need
I needed a custom field that couldn't be provided by the core profile module
How can I create cascading drop down using custom field type in SharePoint 2010.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.