Fb:multi-friend-input

From Facebook Developers Wiki

Jump to: navigation, search

Contents

[edit] Description

Renders a multi-friend form entry field like the one used in the message composer. You can use the field inside an fb:request-form to select users for whom a request can be sent.

Output Adds the following hidden tag inside the form for each user with their user ID for the value.

<input type="hidden" value="123456789" name="ids[]"/>

Here is an example, in PHP, of how to access these IDs.

$friends = (isset($_REQUEST["ids"])) ? $_REQUEST["ids"] : 0;

If users were entered into the multi-friend-input, $friends becomes an array of IDs; otherwise, $friends is 0.


[edit] Attributes

RequiredNameTypeDescription
optional width int The width of entry field. (default value is 350px)
border_color string The color of entry field border. (default value is #8496ba)
include_me bool Indicates whether or not to include the logged-in user in the form. (default value is false)
max int The maximum number of people that can be selected. (default value is 20)
exclude_ids array A comma separated list of user IDs to exclude from the selector.
prefill_ids array A comma separated list of user IDs to pre-populate in the selector. Note that this cannot be used inside an <fb:request-form>.
prefill_locked bool Set to true to prevent editing of the pre-populated IDs.


[edit] Examples

<fb:multi-friend-input width="350px" border_color="#8496ba" exclude_ids="4,5,10,15" />
fb_multiple_friend_input.jpg


[edit] Notes

  • When used inside a mock AJAX form, the ID array contains only the last UID in the multi-friend-input.[possible bug?]
  • You can access all of the values of multi-friend-input using form serialize.
  • When used, it appears to disable the recipient input box on the popup for fb:share-button. [possible bug?]
  • When more than one instance of this tag appears on a page, only the first instance works. [possible bug?]