PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

add List Field entries via jQuery

  1. Hi,
    I want to populate a List Field from a popup window and was hoping I could use jQuery?
    In the popup I will retrieve all FaceBook friends of a user and the user can just press add that is after the friend's name to push it to the List Field (and remove from popup)

    is this possible?

    Posted 12 years ago on Monday March 19, 2012 | Permalink
  2. Okay, I used some javascript to retrieve the friendlist from facebook, iterate over them and add a list field (dual column) and call it via a button
    (I already have the FB.init etc loaded..)

    <script type="text/javascript">
    	function getFriends(){
    		oFormObject = document.forms['gform_5'];
    		FB.login(function(response) {
       			if (response.authResponse) {
    				FB.api('/me/friends', function(response) {
            		if(response.data) {
    				var num = 0;
                	jQuery.each(response.data,function(index,friend) {
    					console.log(num+'-'+friend.name);
    					gformAddListItem(oFormObject.elements["input_8[]"][num], 0);
    					oFormObject.elements["input_8[]"][num].value = friend.name;
    					oFormObject.elements["input_8[]"][num+1].value = '0';
    					num = num + 2;
    
               		 });
            		} else {
    					console.log('error ' );
            			}
       				 });
    			}
    		});
    	}
    </script>

    then added a html block and created a button;
    <input type="button" class="bluebutton" onclick="getFriends()" value="Get facebook Friends"/>

    it seems to work okay, I do something similar to get the name, email, gender and dob of the user to pre-populate those fields for a registration form

    Posted 12 years ago on Wednesday March 21, 2012 | Permalink
  3. Hi,

    I am doing a submission form with Gravity forms and I want to prepopulate the users name and email from their Facebook account. I am using Simple Facebook Connect plugin to log people in, and was wondering if you have the code you used to achieve that?

    Thanks!

    Dave

    Posted 11 years ago on Saturday April 28, 2012 | Permalink
  4. I was looking for the same thing.... I need to use gravity form for user registration and freshbook invoices but I want my clients to also be able to login with facebook after registering.... is this possible?

    Posted 11 years ago on Friday May 11, 2012 | Permalink