Name

<fb:friend-selector/>

Synopsis

<fb:friend-selector/>

A special <fb:typeahead-input/> box that renders a form input text box that autocompletes with a drop-down list of friends’ names, which the user can select from. Only one friend can be chosen with this tag. To select multiple friends, use the <fb:multi-friend-input/> tag. This tag can be used inside and out of <fb:request-form/> tags.

FBML-Specific Attributes

Required

None.

Optional

uid=[int] default: uid of current logged-in-user

The ID of the user to display a <fb:friend-selector/> input box for.

name=[string] default: friend_selector_name

The name of the form element to submit with POST variables.

idname=[string] default: friend_selector_id

The name of the hidden element within the form that displays the ID of the selected friend. If used within <fb:request-form/> tags, do not change it to anything other than friend_selector_id.

include_me=[true|false] default: false

If true, includes the logged-in user in the list of friends to autocomplete.

exclude_ids=[array] default: none

Comma-separated list of user IDs to exclude from the friend’s list. This can be used within an <fb:request-form/> to exclude those friends who have already been invited.

include_lists=[true|false] default: false

If true, includes friends lists in the drop-down list of suggested friends.

Example FBML

Here is example FBML code for <fb:friend-selector/>:

<form>
<fb:friend-selector name="my_friend" idname="my_friend_id" 
    include_me="true" exclude_ids="4,1,2" include_lists="true"/>
</form>

Rendered HTML for Single Instance of Tag

The underlying HTML when rendered looks like this (Figure 3-37 shows the result):

<form>
  <input type="hidden" name="fb_sig_time" value="1206154647.8097" />
  <input type="hidden" name="fb_sig_added" value="0" />
  <input type="hidden" name="fb_sig_user" value="683545112" />
  <input type="hidden" name="fb_sig_profile_update_time"
      value="1205994295" />
  <input type="hidden" name="fb_sig_session_key"
      value="54aeab3103ef387539a31aa1-683545112" />
  <input type="hidden" name="fb_sig_expires" value="0" />
  <input type="hidden" name="fb_sig_api_key"
      value="ba19d367e2d8c4ea5813d54f2cbba136" />
  <input type="hidden" name="fb_sig"
      value="61014ec6e6d947973c28e2b823127bd2" />
  <input name="my_friend" idname="my_friend_id" 
    value="Start typing a friend&#039;s name" 
        class="inputtext typeahead_placeholder" 
    maxlength="100" size="25" autocomplete="off" type="input" 
    onfocus="var typeahead_source_instance1=
       new friend_source(
       &#039;683545112-1206123558-1&amp;u=683545112&amp;include_me=
       1&amp;lists=1&#039;);typeahead_source_instance1.set_exclude_ids(
       {&quot;4&quot;:true,&quot;1&quot;:true,&quot;2&quot;:true});
       new FBML.friendSelector(this, typeahead_source_instance1,{
       should_use_absolute:1});" />
</form>
The result of our <fb:friend-selector/> example if I start typing “Jesse Stay”
Figure 3-37. The result of our <fb:friend-selector/> example if I start typing “Jesse Stay”

Additional Information

  • If a value that doesn’t exist in the list is entered, idname becomes blank and the name value becomes that which was entered.

  • If blank, the idname hidden field is not rendered.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.223.196.146