Talk:Fb:friend-selector

From Facebook Developer Wiki

Jump to: navigation, search

Contents

[edit] Cannot set idname in multiFeedStory form either

Docs say to leave idname as default value for fb:request-forms. Same thing applies to multiFeedStory Feed forms, too. You'll get an error dialog that says 'Please select some friends first' even though you have a valid friend selected in the control. --714497440 14:51, 22 May 2009 (PDT)

Sounds like it could be a bug. Please file a bug. Thanks, Pete (563683308 20:13, 22 May 2009 (PDT))

[edit] Please allow us to style this control

It would be nice if this element didn't have so much influence over the view, but by hard wiring size="25" into it you've made it hard for us to style the width. Why not use style="width:100px;", or better yet, let us pass in the width?

Also, it would be great if we could alter the message, eg use "friend's name" rather than "start typing a friend's name". I can see why you might want to control the text shown here but perhaps the element could have a few "messagelength attributes": short="Friend's name", medium="start typing a friend's name", ridiculouslylong="when you type letters here, we try to find a friend's name that matches what you type"...


[edit] Pre-populate to a specified friend on page load

It seems strange that there's no obvious way of defaulting the friend selector to a particular friend when the page loads. Shouldn't there be a selectedUserID attribute available on the tag? --536286910 13:12, 30 September 2008 (PDT)

 answer: you can now use the "prefill_id" attribute to do this

[edit] Self selection

Can you provide an option to allow the user to select himself? You can tag yourself in photos and users have requested this functionality in other apps. --1326120299 01:25, 29 August 2007 (PDT)

[edit] bug when entering non-friend after initial submit...

I have the following code:

<form method="get" id="select_friend_form">
<fb:friend-selector idname="friend_uid" name="friend_name" />
<input type="submit" class="inputbutton" clickrewriteurl="http://example.com/getstuff_ajax.php" clickrewriteid="aoeu_select" clickrewriteform="select_friend_form" clicktoshow="aoeu_select" value="Select Friend" />
</form><br/>

<div id="aoeu_select">
		
</div>

The div box is displaying what's coming through the POST and the first time a request is made everything works correctly. However, the person can edit the friend-selector input and resend the result and this is where a problem occurs.

If I first enter the name of a friend, friend_uid becomes their uid and friend_name becomes their name (from what I read from the POST in getstuff_ajax.php). If I change the name to someone who isn't a friend or make it blank it alters the friend_name but the friend_uid remains as the last set friend.

Incidentally, the friend_uid is never set to a string containing 'undefined' as the wiki describes.

[edit] Pre Select

Entering a userId and name should preselect this user for display in the box, at the moment it still says Start Typing.... this would be great to have after a user completes a form but there is an error in it.

Another vote for this one. Please create/make use of the "value" attribute to allow a pre-populated value for the friend selector. Thanks!. --719255867 09:29, 10 November 2007 (PST)

How to show the selected current user in the input box? Please help its urgent. We need the value attribute for this.

[edit] App Only

Need one 2 sho ppl who added app

540489399 12:52, 9 October 2007 (PDT)

  • You should simply create a list of friends who have the app installed and do a difference on the users friends - then exclude the list of people who dont have the app installed.
    • iz wat i do now, but timing issue, its adds .3 secs 4 sumthin dat cud be faster

540489399 17:38, 14 October 2007 (PDT)

[edit] get the uid from Javascript?

Is there a way to get the currently selected uid using Javascript?

Since there is no id, I could get the input object by getting the parent and using getFirstChild; but that doesn't tell me what's the current UID is. Using getValue() I can get the full name, and by a hacky way I can get the uid from that (since we now it's a friend) but that's super hacky and I'd rather avoid it.

I need that to use it in a AJAXy call (i.e. not a form that gets submitted and refreshes the page). --500010509 17:34, 5 November 2007 (PST)

 answer : put the uid on an hidden field and get it by the id of the field

Does the method given as an answer actually work? I've tried it, and the value of the hidden field isn't changed every time the friend-selector value changes. I don't think the field changes (or is even created for that matter) until the form is submitted. If you really got it working please post more details! --Courtland 16:30, 7 June 2008 (PDT)


I'm annoyed with this too...based on my testing the "hidden form element" for this control isn't created until form submit which leaves it useless for cleitn side DOM access...anyone know of a better work around than looking up the UID based on the name?


 answer : set the "idname" attribute on the friend selector, then on form submit, serialize the form element and use the name to access
 Example: 

<form id="myform" onsubmit="return checkFriend()">
<fb:friend-selector idname="myfriend" />
<input type="submit" />
</form>
<script>
function checkFriend()
{
var params = document.getElementById( 'myform' ).serialize();
new Dialog().showMessage( 'My Friend ID', params.myfriend );
return false;
}
</script>

[edit] Styling

Which attributes are available to styling? I can't seem to override the styling (width/height/etc) for the selector.

[edit] Excluding people who have excluded themselves from the facebook API?

I'm having a hard time eliminating people who have taken themselves off the facebook API. I'm trying to have a friend selector box that only shows your friends that have the application installed. The problem is that since I can't find their uids, I can't exclude them. Any ideas? Seems weird that they would even show up in the first place since they obviously don't want anything to do with facebook applications.

I am also having this problem -- I don't want my users to be able to choose people from the drop-down if they're invisible to the API. Worse, it's untestable -- one drop-down says you're friends, and then areFriends returns false. (Or at least it does if you're using a toolkit which ignores this case.) I don't see anything in the API that would let me test this case by itself, to at least do some error handling.

[edit] friend_source is not defined

anyone else getting this? 548871286 19:18, 12 June 2008 (PDT)

[edit] Please write source code...

Please any body write here some source code for Fb:friend-selector.

Thank you.

[edit] Don't deprecate this tag!

A note has been added to this page that FB intends to deprecate this tag as part of the Inbox project. Sending an invite/request is not the only use of this tag! It should not be removed as part of the move of invites and requests to the Inbox. Any application that needs to pick a friend in any other capacity (sending someone a GroupCard comes to mind) needs functionality like this.

Since we're moving the functionality to the Inbox, users can specify recipients in the typeahead. Pete -- 563683308 11:45, 2 November 2009 (PST)

Following up: my point is that sending an invite/request is not the only current use of this tag, and the inbox does not cover all the possible cases. We will be forced to re-implement this functionality when we need it outside of the inbox/messaging functionality (like the GroupCard example, in which you need to pick a target user for the card you're creating, but you don't to actually contact that user yet, since the card hasn't been signed by anyone yet).

reference