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 8186861
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T02:22:04+00:00 2026-06-07T02:22:04+00:00

I have a code that I want to auto-submit 5 seconds after Facebook has

  • 0

I have a code that I want to auto-submit 5 seconds after Facebook has returned the user details. However the code fails to auto submit. I cant find an error.
My code is shown below

<?php 
   //some php functions to process the submitted form
 ?>       
        <div>
            <div id="fb-root"></div>        
            <script type="text/javascript">
                window.fbAsyncInit = function() {
                    FB.init({appId: 'xxxxxxxxxxxxxxxx', status: true, cookie: true, xfbml: true});
                    /* All the events registered */
                    FB.Event.subscribe('auth.login', function(response) {
                       login();
                    });
                    FB.Event.subscribe('auth.logout', function(response) {

                        logout();
                    });
                    FB.getLoginStatus(function(response) {
                        if (response.session) {
                            login();
                        }
                    });
                    FB.getLoginStatus(function(response) {
                        login();
                        logout();
                    });
                };
                (function() {
                    var e = document.createElement('script');
                    e.type = 'text/javascript';
                    e.src = document.location.protocol +
                        '//connect.facebook.net/en_US/all.js';
                    e.async = true;
                    document.getElementById('fb-root').appendChild(e);
                }());

                function login(){
                    FB.api('/me',function(response) {

                        if(typeof response.name != 'undefined')
                        {
                            document.getElementById('hideDiv').style.visibility = 'hidden';                      
                            document.signupForm.first_name.value=response.first_name;
                            document.signupForm.last_name.value=response.last_name;
                            document.signupForm.username.value=response.username;
                            document.signupForm.email.value=response.email;

                        }

                    });
                }

                function logout(){
                    //document.getElementById('login').style.display = "none";
                }

                setTimeout("document.signupForm.submit();",5000); //5 seconds

            </script>
           <form id="signupForm" name="signupForm" class="phorm2" action="" method="post">
                <h3>Sign up</h3>
                <div id="hideDiv">Get details from Facebook
                    <fb:login-button autologoutlink="true" perms="email,user_birthday,status_update,publish_stream"></fb:login-button>
                </div>
                <br>
                <label class="short" for="first_name">First Name</label>
                <input type="text" name="first_name" id="first_name" />
                <br>
                <label class="short" for="last_name">Last Name</label>
                <input type="text" name="last_name" id="last_name" />
                <br>
                <label class="short" for="username">Username</label>
                <input type="text" name="username" id="username" /> 
                <br>
                <label class="short" for="email">Email</label>
                <input type="text" name="email" id="email"/>
                <br>
                <label class="short" for="submit">&nbsp;</label>
                <input type="submit" name="submit" value="Sign me up" class="Cart66ButtonPrimary" />
            </form>
        </div>
  • 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-07T02:22:06+00:00Added an answer on June 7, 2026 at 2:22 am

    Your code runs as soon as the head is loaded, there was no form at that time.

    Remove this line from current position

    setTimeout("document.signupForm.submit();",5000); //5 seconds
    

    And add here,

    FB.api('/me',function(response) { 
        if(typeof response.name != 'undefined'){
            document.getElementById('hideDiv').style.visibility = 'hidden';                      
            document.signupForm.first_name.value=response.first_name;
            document.signupForm.last_name.value=response.last_name;
            document.signupForm.username.value=response.username;
            document.signupForm.email.value=response.email; 
        }
       setTimeout(function(){
           document.signupForm.submit();
       },5000); //5 seconds  
        // Never put a string in as parameter in  setTimeout
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a code like that this, I want to delete the imageview after
I have code that I want to look like this: List<Type> Os; ... foreach
I have code that I want to compile on all unix systems, but if
I have code that I want to be executed before every action is called.
I have some code that I want to put into an svn repository for
I have this code that I want to make point-free; (\k t -> chr
I have code like that 010200345 i want split every first three digit please
I have this html code that i want to edit with jQuery. Here is
I have the simplest code that I want to separate in three files: Header
I have some code ( ILColorPicker ) that I want to install into my

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.