Fb:friend-selector
From Facebook Developer Wiki
Contents |
Description
Facebook is modifying the way you can use the friend selectors. Details will follow soon.
For more information, please read the Developer Roadmap, specifically, the sections on requests and invites.
Renders a predictive friend selector input for a given person. You can use this tag inside an fb:request-form to select users for whom a request can be sent.
Attributes
| Required | Name | Type | Description | |
| optional | uid | int | The user whose friends you can select. (Default value is the uid of the currently logged-in user.) | |
|---|---|---|---|---|
| name | string | The name of the form element. (Default value is friend_selector_name.) | ||
| idname | string | The name of the hidden form element that contains the user ID of the selected friend. If you are using this tag inside fb:request-form, do not override the default. (Default value is friend_selector_id.) | ||
| include_me | bool | Indicates whether or not to include the logged in user in the suggested options. (Default value is false.) | ||
| exclude_ids | array | A list of user IDs to exclude from the selector. (comma-separated) | ||
| include_lists | bool | Indicates whether or not to include friend lists in the suggested options. (Default value is false.) | ||
| prefill_id | bool | A single user ID to pre-populate in the selector. If the viewing user cannot see the prefilled user's name due to privacy, then this parameter will be ignored. Note that this cannot be used inside an <fb:request-form>. (Default value is null.) |
Examples
<fb:friend-selector uid="123445" name="uid" idname="friend_sel" />
![]() |
<form action="http://www.example.com/handler.php" id="testForm" method="post">
<fb:friend-selector uid="12345" name="uid" idname="grab_me_please" prefill_id="7906796"/>
<INPUT type="submit" value="test">
</form>
Notes
- If the user enters a name that does not match any of his friends,
idnamegets set to an empty string (instead of auidnumber) andnamegets set to the entered text. - If no value is entered then
idnameis not added as a hidden field in the POST.
Bugs
- "friend selector is not a constructor" - hi priority bug
- If a valid friend is entered and selected from the drop-down completion, the
idnamegets set to that person'suidand remains as that value unless another valid friend is entered. This means, if I enter a valid friend and then delete the entry to make it blank (or a non-friend), it sends that previous friend'suidinidname, but sends a blank string (or the non-friend's name) inname.- Just check if the name is empty. People don't usually submit a half-typed friend's name.
- Even better. Put a parent element around the selector. On submit, use parent.getFirstChild().hasClassName('typeahead_found') to check if the user really meant to submit that friend. You could then use your own hidden field to mark the selector output to be ignored.
- Just check if the name is empty. People don't usually submit a half-typed friend's name.

