SlideShare a Scribd company logo
1 of 9
Download to read offline
Fb:request-form
From Facebook Developers Wiki

Description
Creates a form that sends requests to the selected users. To send requests/invitations to multiple
users, create one of these forms and include either an fb:multi-friend-selector or any combination
of fb:multi-friend-input, fb:friend-selector and fb:request-form-submit. The form is submitted
after the user confirms the sending of the request.

If you want to invite only one friend, without making the user select from a list of friends, use
the fb:request-form-submit tag within the fb:request-form tag, and make sure to set the
appropriate attributes (uid, label) on the submit button to indicate that you are sending an invite
to only one friend.

In general, use fb:multi-friend-selector in a nearly full-page invitation interface where the user is
intended to select a large number of people, and fb:friend-selector or fb:multi-friend-input in
situations where the user is selecting a smaller number of users and you want to integrate it into
the context of your own page. As a middle-ground alternative, you can use the fb:multi-friend-
selector (condensed) for places where the user might select a medium-sized list of people without
needing a full-page interstitial invitations interface.

For developers using iframes, you cannot get the full flexibility of the fb:request-form system.
However, you can still send requests using the Multi_friend_selector, or you can use the
fb_force_mode parameter to render a particular canvas page with FBML.

For developers wishing to utilize more form parameters, typical form input can be used with the
attribute fb-protected="true" within any fb:request-form-submit tag.




Attributes
Required Name       Type     Description
required type       string   The type of request or invitation to generate. This corresponds to
                             the word that is displayed on the home page. For example, "event."
           content string The contents of the request or invitation to be sent. It should use
                          FBML formatting that contains only links and the special tag
                          <fb:req-choice url="" label="" /> to specify the buttons to be
                          included in the request. Make sure that you properly encode this
                          attribute. For example, use the PHP "htmlentities" function.
optional invite   bool     Set this to true if you want to send an invitation or false if you
                           want to send a request. The difference between them is in the
                           content that the user sees. (Default value is false.)
         action   string   The place where a user gets redirected after submitting the form
                           through the fb:request-form-submit button or when they click Skip
                           this Step. By default the user is directed to
                           http://apps.facebook.com/yourapp/null. Note: This default
                           behavior may not be preserved.[verify]
         method string Set it to either GET or POST, as you would with a form.




POST Variables
Required Name       Type     Description
         typeahead string The string containing any content the user typed into the multi-
                          selector box.
         ids        array    A zero-based array containing all of the user IDs of the people
                             the user invited.




Examples
Example FBML Invite Page

<fb:fbml>
<fb:request-form
action="index.php"
method="POST" invite="true" type="YOUR APP NAME" content="Your
text
goes here. <?php echo htmlentities("<fb:req-choice url="YOUR
CANVAS URL" label="Add My Application"") ?> >
<fb:multi-friend-selector showborder="false" actiontext="Invite
your
friends to use YOUR APP NAME."> </fb:request-form>
</fb:fbml>


Example Java Invite Page
Here is the FBML:

<fb:request-form
    action="start.htm"
    method="POST"
    invite="true"
    type="nutshOt network"
    content="nutshOt network is the best place on Facebook for
viewing, sharing and giving
             friends the   highest quality nutshOts. Join me on
the nutshOt network!
          <fb:req-choice
url='http://www.facebook.com/add.php?api_key=<c:out
value='${apiKey}' />'
             label='Check out the nutshOt network!' />
    ">

     <fb:multi-friend-selector
          showborder="false"
          actiontext="Invite your friends to the nutshOt
network."
          exclude_ids="<c:out value='${appUserFriends}' />"
          max="20" />
</fb:request-form>

Here is the server side Java:

protected Map referenceData(HttpServletRequest request) throws
Exception {
     logger.info("InviteFriendsFormController.referenceData
...");

     FacebookRestClient facebookRestClient =
getFacebookUtils().getFacebookRestClient(request);

     //get the list of friends who are app users so they can be
excluded from the invite page
     String appUserFriends =
getFacebookUtils().getAppUsersFriendsString(facebookRestClient);
HashMap referenceData = new HashMap();
     referenceData.put("appUserFriends", appUserFriends);
     referenceData.put("apiKey",
PropertyUtils.getInstance().getPropertyValue("API_KEY"));
     getFacebookUtils().loadUrlData(referenceData);

      return referenceData;
}

You can see it in action at   The nutshOt network




Example PHP Invite Page

<?php
require_once('config.php');
require_once('init.php');
require_once('lib.php');
$user
= $facebook->require_login();
// Get list of friends who have this app installed...
$rs = $facebook->api_client->fql_query("SELECT uid FROM user
WHERE has_added_app=1 and uid IN (SELECT uid2 FROM friend WHERE
uid1 =
$user)");
$arFriends = "";
// Build an delimited list of users...
if ($rs)
{ $arFriends .= $rs[0]["uid"]; for ( $i = 1; $i < count($rs);
$i++ )
{ if ( $arFriends != "" ) $arFriends .= ","; $arFriends .=
$rs[$i]["uid"]; }
}
// Construct a next url for referrals
$sNextUrl = urlencode("&refuid=".$user);
// Build your invite text
$invfbml = <<<FBML
You've been invited to join the PickPocket™ Guild!
<fb:name uid="$user" firstnameonly="true" shownetwork="false"/>
wants you to add PickPocket™ so that you can join <fb:pronoun
possessive="true" uid="$user"/> wily band of thieves!
<fb:req-choice
url="http://www.facebook.com/add.php?api_key=$appapikey&next=$sN
extUrl"
label="Join the Guild!" />
FBML;
?>
<fb:request-form type="PickPocket" action="index.php?c=skipped"
content="<?=htmlentities($invfbml)?>" invite="true">
<fb:multi-friend-selector max="20" actiontext="Here are your
friends
who don't have PickPocket™. Invite them to play with you!"
showborder="true" rows="5" exclude_ids="<?=$arFriends?>">
</fb:request-form>
Example Overloaded Form

<fb:fbml>
<fb:request-form
method="POST" action="compare.php" content="some content"
type=""
invite="false"> <input id="first_overloaded_id" type="hidden"
fb_protected="true" value="first_overloaded_value"
name="first_overloaded_name"/> <input id="second_overloaded_id"
type="hidden" fb_protected="true"
value="second_overloaded_value"
name="second_overloaded_name"/> <div class="clearfix"
style="padding-bottom: 10px;"> <fb:multi-friend-selector
condensed="true" style="width:80%;" /> </div>
<fb:request-form-submit />
</fb:request-form>
</fb:fbml>


Example ASP.NET Invite Page

<p>Invite
a friend to use this application...
<fb:request-form action="default.aspx" method="POST"
invite="true"
type="Test App" content="You have been invited to the Test
Example
application. <% = Server.HtmlEncode("<fb:req-choice
url="http://apps.facebook.com/test/default.aspx" label="OK"
/>")
%> " > <fb:friend-selector showborder="false"
actiontext="Invite your friends to use this application." />
<fb:request-form-submit />
</fb:request-form>
</p>


Example Python (Django + PyFacebook) Invite Page

def invite_friends(request):
    #HTML escape function for invitation content.
    from cgi import escape

    facebook_uid = request.facebook.uid
    fql = "SELECT uid FROM user WHERE uid IN (SELECT uid2 FROM
friend WHERE uid1='%s') AND has_added_app = 1" % facebook_uid
result = request.facebook.fql.query(fql)

    # Extract the user ID's returned in the FQL request into a
new array.
    if result and isinstance(result, list):
        friends_list = map(lambda x: str(x['uid']), result)
    else:
        friends_list = []
    # Convert the array of friends into a comma-delimeted
string.
    exclude_ids = ','.join(friends_list)

    # Prepare the invitation text that all invited users will
receive.
    content = """<fb:name uid="%s" firstnameonly="true"
shownetwork="false"/>
        wants to invite you to play Online board games,
             <fb:req-choice url="%s"
     label="Add Online Gaming and Video Chat to your profile!"/>
     """ % (facebook_uid, request.facebook.get_add_url())

     invitation_content = escape(content, True)

    return render_to_response('facebook/invite_friends.fbml',
                               {'content': invitation_content,
'exclude_ids': exclude_ids })


Example Python (Django + PyFacebook) Invite Friends template

<fb:request-form
action="http://apps.facebook.com/livevideochat/?skipped=1"
method="POST" invite="true" type="Online Games" content="{{
content
}}"> <fb:multi-friend-selector max="20" actiontext="Here are
your
friends who haven't added Online Games and Live Video Chat to
their
profile. Invite them to play Games Online today!"
showborder="true"
rows="5" exclude_ids="{{ exclude_ids }}">
</fb:request-form>




Notes
      Make sure to include whatever attributes you would normally include if you were
       creating a <form> tag, such as action and method, as mentioned above.

      The fb:multi-friend-selector tag does not show up in Internet Explorer 6.[verify][I have IE 6
       and it works fine]

      The type attribute appears to have a hard limit of 20 characters. Anything else is
       truncated.

Retrieved from "http://wiki.developers.facebook.com/index.php/Fb:request-form"

Categories: Unverified statements | Articles needing screenshots | FBML tags

More Related Content

Viewers also liked

Catalog 1
Catalog 1Catalog 1
Catalog 1tamirc
 
10 Insightful Quotes On Designing A Better Customer Experience
10 Insightful Quotes On Designing A Better Customer Experience10 Insightful Quotes On Designing A Better Customer Experience
10 Insightful Quotes On Designing A Better Customer ExperienceYuan Wang
 
Learn BEM: CSS Naming Convention
Learn BEM: CSS Naming ConventionLearn BEM: CSS Naming Convention
Learn BEM: CSS Naming ConventionIn a Rocket
 
SEO: Getting Personal
SEO: Getting PersonalSEO: Getting Personal
SEO: Getting PersonalKirsty Hulse
 
How to Build a Dynamic Social Media Plan
How to Build a Dynamic Social Media PlanHow to Build a Dynamic Social Media Plan
How to Build a Dynamic Social Media PlanPost Planner
 
The Outcome Economy
The Outcome EconomyThe Outcome Economy
The Outcome EconomyHelge Tennø
 
The Six Highest Performing B2B Blog Post Formats
The Six Highest Performing B2B Blog Post FormatsThe Six Highest Performing B2B Blog Post Formats
The Six Highest Performing B2B Blog Post FormatsBarry Feldman
 

Viewers also liked (7)

Catalog 1
Catalog 1Catalog 1
Catalog 1
 
10 Insightful Quotes On Designing A Better Customer Experience
10 Insightful Quotes On Designing A Better Customer Experience10 Insightful Quotes On Designing A Better Customer Experience
10 Insightful Quotes On Designing A Better Customer Experience
 
Learn BEM: CSS Naming Convention
Learn BEM: CSS Naming ConventionLearn BEM: CSS Naming Convention
Learn BEM: CSS Naming Convention
 
SEO: Getting Personal
SEO: Getting PersonalSEO: Getting Personal
SEO: Getting Personal
 
How to Build a Dynamic Social Media Plan
How to Build a Dynamic Social Media PlanHow to Build a Dynamic Social Media Plan
How to Build a Dynamic Social Media Plan
 
The Outcome Economy
The Outcome EconomyThe Outcome Economy
The Outcome Economy
 
The Six Highest Performing B2B Blog Post Formats
The Six Highest Performing B2B Blog Post FormatsThe Six Highest Performing B2B Blog Post Formats
The Six Highest Performing B2B Blog Post Formats
 

Similar to Fb request form guide

Traxo Presentation - Facebook Garage Dallas 09
Traxo Presentation - Facebook Garage Dallas 09Traxo Presentation - Facebook Garage Dallas 09
Traxo Presentation - Facebook Garage Dallas 09Chris Stevens
 
funP 開發者俱樂部 十月份聚會
funP 開發者俱樂部 十月份聚會funP 開發者俱樂部 十月份聚會
funP 開發者俱樂部 十月份聚會tutchiio
 
funP 麻吉 開發者俱樂部十月份聚會
funP 麻吉 開發者俱樂部十月份聚會funP 麻吉 開發者俱樂部十月份聚會
funP 麻吉 開發者俱樂部十月份聚會Nathan Chiu
 
The Django Book - Chapter 7 forms
The Django Book - Chapter 7 formsThe Django Book - Chapter 7 forms
The Django Book - Chapter 7 formsVincent Chien
 
Cbcode volume2
Cbcode volume2Cbcode volume2
Cbcode volume2Madfex
 
[PHP 也有 Day] 垃圾留言守城記 - 用 Laravel 阻擋 SPAM 留言的奮鬥史
[PHP 也有 Day] 垃圾留言守城記 - 用 Laravel 阻擋 SPAM 留言的奮鬥史[PHP 也有 Day] 垃圾留言守城記 - 用 Laravel 阻擋 SPAM 留言的奮鬥史
[PHP 也有 Day] 垃圾留言守城記 - 用 Laravel 阻擋 SPAM 留言的奮鬥史Shengyou Fan
 
Introduction to facebook platform
Introduction to facebook platformIntroduction to facebook platform
Introduction to facebook platformVenkatesh Narayanan
 
So you want to build a facebook App ?
So you want to build a facebook App ?So you want to build a facebook App ?
So you want to build a facebook App ?Nguyễn Duy Nhân
 
MozCon Seattle 2011 - Social Design
MozCon Seattle 2011 - Social DesignMozCon Seattle 2011 - Social Design
MozCon Seattle 2011 - Social DesignMat Clayton
 
Facebook Apps: Ein Entwicklungsleitfaden - WMMRN
Facebook Apps: Ein Entwicklungsleitfaden - WMMRNFacebook Apps: Ein Entwicklungsleitfaden - WMMRN
Facebook Apps: Ein Entwicklungsleitfaden - WMMRNStephan Hochdörfer
 
Beautiful Java EE - PrettyFaces
Beautiful Java EE - PrettyFacesBeautiful Java EE - PrettyFaces
Beautiful Java EE - PrettyFacesLincoln III
 
Facebook Developer Garage Cyberjaya
Facebook Developer Garage CyberjayaFacebook Developer Garage Cyberjaya
Facebook Developer Garage CyberjayaMehedi Hasan Sumon
 
FamilySearch Reference Client
FamilySearch Reference ClientFamilySearch Reference Client
FamilySearch Reference ClientDallan Quass
 
Spca2014 hillier 3rd party_javascript_libraries
Spca2014 hillier 3rd party_javascript_librariesSpca2014 hillier 3rd party_javascript_libraries
Spca2014 hillier 3rd party_javascript_librariesNCCOMMS
 
Gem christmas calendar
Gem christmas calendarGem christmas calendar
Gem christmas calendarerichsen
 
Facebook Open Graph Tech Requirements
Facebook Open Graph Tech RequirementsFacebook Open Graph Tech Requirements
Facebook Open Graph Tech RequirementsAffinitive
 
JavaServer Faces 2.0 - JavaOne India 2011
JavaServer Faces 2.0 - JavaOne India 2011JavaServer Faces 2.0 - JavaOne India 2011
JavaServer Faces 2.0 - JavaOne India 2011Arun Gupta
 

Similar to Fb request form guide (20)

Traxo Presentation - Facebook Garage Dallas 09
Traxo Presentation - Facebook Garage Dallas 09Traxo Presentation - Facebook Garage Dallas 09
Traxo Presentation - Facebook Garage Dallas 09
 
funP 開發者俱樂部 十月份聚會
funP 開發者俱樂部 十月份聚會funP 開發者俱樂部 十月份聚會
funP 開發者俱樂部 十月份聚會
 
Web I - 04 - Forms
Web I - 04 - FormsWeb I - 04 - Forms
Web I - 04 - Forms
 
funP 麻吉 開發者俱樂部十月份聚會
funP 麻吉 開發者俱樂部十月份聚會funP 麻吉 開發者俱樂部十月份聚會
funP 麻吉 開發者俱樂部十月份聚會
 
The Django Book - Chapter 7 forms
The Django Book - Chapter 7 formsThe Django Book - Chapter 7 forms
The Django Book - Chapter 7 forms
 
Html forms
Html formsHtml forms
Html forms
 
Cbcode volume2
Cbcode volume2Cbcode volume2
Cbcode volume2
 
[PHP 也有 Day] 垃圾留言守城記 - 用 Laravel 阻擋 SPAM 留言的奮鬥史
[PHP 也有 Day] 垃圾留言守城記 - 用 Laravel 阻擋 SPAM 留言的奮鬥史[PHP 也有 Day] 垃圾留言守城記 - 用 Laravel 阻擋 SPAM 留言的奮鬥史
[PHP 也有 Day] 垃圾留言守城記 - 用 Laravel 阻擋 SPAM 留言的奮鬥史
 
Introduction to facebook platform
Introduction to facebook platformIntroduction to facebook platform
Introduction to facebook platform
 
Jsf
JsfJsf
Jsf
 
So you want to build a facebook App ?
So you want to build a facebook App ?So you want to build a facebook App ?
So you want to build a facebook App ?
 
MozCon Seattle 2011 - Social Design
MozCon Seattle 2011 - Social DesignMozCon Seattle 2011 - Social Design
MozCon Seattle 2011 - Social Design
 
Facebook Apps: Ein Entwicklungsleitfaden - WMMRN
Facebook Apps: Ein Entwicklungsleitfaden - WMMRNFacebook Apps: Ein Entwicklungsleitfaden - WMMRN
Facebook Apps: Ein Entwicklungsleitfaden - WMMRN
 
Beautiful Java EE - PrettyFaces
Beautiful Java EE - PrettyFacesBeautiful Java EE - PrettyFaces
Beautiful Java EE - PrettyFaces
 
Facebook Developer Garage Cyberjaya
Facebook Developer Garage CyberjayaFacebook Developer Garage Cyberjaya
Facebook Developer Garage Cyberjaya
 
FamilySearch Reference Client
FamilySearch Reference ClientFamilySearch Reference Client
FamilySearch Reference Client
 
Spca2014 hillier 3rd party_javascript_libraries
Spca2014 hillier 3rd party_javascript_librariesSpca2014 hillier 3rd party_javascript_libraries
Spca2014 hillier 3rd party_javascript_libraries
 
Gem christmas calendar
Gem christmas calendarGem christmas calendar
Gem christmas calendar
 
Facebook Open Graph Tech Requirements
Facebook Open Graph Tech RequirementsFacebook Open Graph Tech Requirements
Facebook Open Graph Tech Requirements
 
JavaServer Faces 2.0 - JavaOne India 2011
JavaServer Faces 2.0 - JavaOne India 2011JavaServer Faces 2.0 - JavaOne India 2011
JavaServer Faces 2.0 - JavaOne India 2011
 

Fb request form guide

  • 1. Fb:request-form From Facebook Developers Wiki Description Creates a form that sends requests to the selected users. To send requests/invitations to multiple users, create one of these forms and include either an fb:multi-friend-selector or any combination of fb:multi-friend-input, fb:friend-selector and fb:request-form-submit. The form is submitted after the user confirms the sending of the request. If you want to invite only one friend, without making the user select from a list of friends, use the fb:request-form-submit tag within the fb:request-form tag, and make sure to set the appropriate attributes (uid, label) on the submit button to indicate that you are sending an invite to only one friend. In general, use fb:multi-friend-selector in a nearly full-page invitation interface where the user is intended to select a large number of people, and fb:friend-selector or fb:multi-friend-input in situations where the user is selecting a smaller number of users and you want to integrate it into the context of your own page. As a middle-ground alternative, you can use the fb:multi-friend- selector (condensed) for places where the user might select a medium-sized list of people without needing a full-page interstitial invitations interface. For developers using iframes, you cannot get the full flexibility of the fb:request-form system. However, you can still send requests using the Multi_friend_selector, or you can use the fb_force_mode parameter to render a particular canvas page with FBML. For developers wishing to utilize more form parameters, typical form input can be used with the attribute fb-protected="true" within any fb:request-form-submit tag. Attributes Required Name Type Description required type string The type of request or invitation to generate. This corresponds to the word that is displayed on the home page. For example, "event." content string The contents of the request or invitation to be sent. It should use FBML formatting that contains only links and the special tag <fb:req-choice url="" label="" /> to specify the buttons to be included in the request. Make sure that you properly encode this attribute. For example, use the PHP "htmlentities" function.
  • 2. optional invite bool Set this to true if you want to send an invitation or false if you want to send a request. The difference between them is in the content that the user sees. (Default value is false.) action string The place where a user gets redirected after submitting the form through the fb:request-form-submit button or when they click Skip this Step. By default the user is directed to http://apps.facebook.com/yourapp/null. Note: This default behavior may not be preserved.[verify] method string Set it to either GET or POST, as you would with a form. POST Variables Required Name Type Description typeahead string The string containing any content the user typed into the multi- selector box. ids array A zero-based array containing all of the user IDs of the people the user invited. Examples Example FBML Invite Page <fb:fbml> <fb:request-form action="index.php" method="POST" invite="true" type="YOUR APP NAME" content="Your text goes here. <?php echo htmlentities("<fb:req-choice url="YOUR CANVAS URL" label="Add My Application"") ?> > <fb:multi-friend-selector showborder="false" actiontext="Invite your friends to use YOUR APP NAME."> </fb:request-form> </fb:fbml> Example Java Invite Page
  • 3. Here is the FBML: <fb:request-form action="start.htm" method="POST" invite="true" type="nutshOt network" content="nutshOt network is the best place on Facebook for viewing, sharing and giving friends the highest quality nutshOts. Join me on the nutshOt network! <fb:req-choice url='http://www.facebook.com/add.php?api_key=<c:out value='${apiKey}' />' label='Check out the nutshOt network!' /> "> <fb:multi-friend-selector showborder="false" actiontext="Invite your friends to the nutshOt network." exclude_ids="<c:out value='${appUserFriends}' />" max="20" /> </fb:request-form> Here is the server side Java: protected Map referenceData(HttpServletRequest request) throws Exception { logger.info("InviteFriendsFormController.referenceData ..."); FacebookRestClient facebookRestClient = getFacebookUtils().getFacebookRestClient(request); //get the list of friends who are app users so they can be excluded from the invite page String appUserFriends = getFacebookUtils().getAppUsersFriendsString(facebookRestClient);
  • 4. HashMap referenceData = new HashMap(); referenceData.put("appUserFriends", appUserFriends); referenceData.put("apiKey", PropertyUtils.getInstance().getPropertyValue("API_KEY")); getFacebookUtils().loadUrlData(referenceData); return referenceData; } You can see it in action at The nutshOt network Example PHP Invite Page <?php require_once('config.php'); require_once('init.php'); require_once('lib.php'); $user = $facebook->require_login(); // Get list of friends who have this app installed... $rs = $facebook->api_client->fql_query("SELECT uid FROM user WHERE has_added_app=1 and uid IN (SELECT uid2 FROM friend WHERE uid1 = $user)"); $arFriends = ""; // Build an delimited list of users... if ($rs) { $arFriends .= $rs[0]["uid"]; for ( $i = 1; $i < count($rs); $i++ ) { if ( $arFriends != "" ) $arFriends .= ","; $arFriends .= $rs[$i]["uid"]; } } // Construct a next url for referrals $sNextUrl = urlencode("&refuid=".$user); // Build your invite text $invfbml = <<<FBML
  • 5. You've been invited to join the PickPocket™ Guild! <fb:name uid="$user" firstnameonly="true" shownetwork="false"/> wants you to add PickPocket™ so that you can join <fb:pronoun possessive="true" uid="$user"/> wily band of thieves! <fb:req-choice url="http://www.facebook.com/add.php?api_key=$appapikey&next=$sN extUrl" label="Join the Guild!" /> FBML; ?> <fb:request-form type="PickPocket" action="index.php?c=skipped" content="<?=htmlentities($invfbml)?>" invite="true"> <fb:multi-friend-selector max="20" actiontext="Here are your friends who don't have PickPocket™. Invite them to play with you!" showborder="true" rows="5" exclude_ids="<?=$arFriends?>"> </fb:request-form>
  • 6. Example Overloaded Form <fb:fbml> <fb:request-form method="POST" action="compare.php" content="some content" type=""
  • 7. invite="false"> <input id="first_overloaded_id" type="hidden" fb_protected="true" value="first_overloaded_value" name="first_overloaded_name"/> <input id="second_overloaded_id" type="hidden" fb_protected="true" value="second_overloaded_value" name="second_overloaded_name"/> <div class="clearfix" style="padding-bottom: 10px;"> <fb:multi-friend-selector condensed="true" style="width:80%;" /> </div> <fb:request-form-submit /> </fb:request-form> </fb:fbml> Example ASP.NET Invite Page <p>Invite a friend to use this application... <fb:request-form action="default.aspx" method="POST" invite="true" type="Test App" content="You have been invited to the Test Example application. <% = Server.HtmlEncode("<fb:req-choice url="http://apps.facebook.com/test/default.aspx" label="OK" />") %> " > <fb:friend-selector showborder="false" actiontext="Invite your friends to use this application." /> <fb:request-form-submit /> </fb:request-form> </p> Example Python (Django + PyFacebook) Invite Page def invite_friends(request): #HTML escape function for invitation content. from cgi import escape facebook_uid = request.facebook.uid fql = "SELECT uid FROM user WHERE uid IN (SELECT uid2 FROM friend WHERE uid1='%s') AND has_added_app = 1" % facebook_uid
  • 8. result = request.facebook.fql.query(fql) # Extract the user ID's returned in the FQL request into a new array. if result and isinstance(result, list): friends_list = map(lambda x: str(x['uid']), result) else: friends_list = [] # Convert the array of friends into a comma-delimeted string. exclude_ids = ','.join(friends_list) # Prepare the invitation text that all invited users will receive. content = """<fb:name uid="%s" firstnameonly="true" shownetwork="false"/> wants to invite you to play Online board games, <fb:req-choice url="%s" label="Add Online Gaming and Video Chat to your profile!"/> """ % (facebook_uid, request.facebook.get_add_url()) invitation_content = escape(content, True) return render_to_response('facebook/invite_friends.fbml', {'content': invitation_content, 'exclude_ids': exclude_ids }) Example Python (Django + PyFacebook) Invite Friends template <fb:request-form action="http://apps.facebook.com/livevideochat/?skipped=1" method="POST" invite="true" type="Online Games" content="{{ content }}"> <fb:multi-friend-selector max="20" actiontext="Here are your friends who haven't added Online Games and Live Video Chat to their profile. Invite them to play Games Online today!" showborder="true"
  • 9. rows="5" exclude_ids="{{ exclude_ids }}"> </fb:request-form> Notes  Make sure to include whatever attributes you would normally include if you were creating a <form> tag, such as action and method, as mentioned above.  The fb:multi-friend-selector tag does not show up in Internet Explorer 6.[verify][I have IE 6 and it works fine]  The type attribute appears to have a hard limit of 20 characters. Anything else is truncated. Retrieved from "http://wiki.developers.facebook.com/index.php/Fb:request-form" Categories: Unverified statements | Articles needing screenshots | FBML tags