Fb:multi-friend-input

From Facebook Developer Wiki

Jump to: navigation, search

Contents

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"] : null);

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


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.
name bool The name that should be given to the array of selected user IDs. This defaults to ids for the first <fb:multi-friend-input>, and to fb_multi_friend_input_ids<n> for all by the first. In general, you should include name attributes if you include more than one <fb:multi-friend-input> in a single page.


Examples

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


Notes

  • When used inside a mock AJAX form, the ID array contains only the last UID in the multi-friend-input.[possible bug?] - this actually seems to return all input ids when using mock ajax as of 10/29-08
  • 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 using with prefil_locked=true, the input appears to be read-only. [possible bug?]
reference