Name

<fb:request-form/>

Synopsis

<fb:request-form type="..." content="...">...</fb:request-form>

Renders a standard Facebook invite form. It must include either an <fb:multi-friend-selector/> tag or a combination of <fb:multi-friend-input/> or <fb:friend-selector/> tags and the <fb:request-form-submit/> tag. FBML invite tags are one of the biggest reasons to base your application on FBML instead of purely on <iframe/> tags, as these invite tags can save developers a lot of time producing a list of friends and necessary calls to invite those friends. It should also be noted that FBML is the most effective method of sending invites—these forms are the only ways to invite a user’s friends to an app. To display a custom form on your own, you may want to look into the notifications API call.

FBML-Specific Attributes

Required

type=[string] default: none

The name to include in the invite. It will appear as something to the effect of “1 [type] request” under “Requests” in the upper-right corner of your main Facebook page. It has a limit of 20 characters.

content=[string] default: none

The content of the request invitation to send to the friend(s) being invited.

Optional

invite=[true|false] default: false

Specifies whether it is an invitation or a request. The only difference is that if true, it says, “[name] sent an invitation using [type]:” whereas if false, it says, “[name] sent a request using [type]:”.

action=[string] default: http://apps.facebook.com/yourapp/null

The URL to redirect the user after they submit the form, or after they click “Skip” in the form.

method=[GET|POST] default: POST

Specifies whether to submit the form via either the method GET or POST.

Example FBML

The following FBML example for the <fb:request-form/> tag comes from our “Hello Friends” example in Chapter 1:

<fb:request-form action="index.php" method="POST" invite="true" 
    type="FBML Essentials" content="Hello Friend. <fb:req-choice 
    url='http://apps.facebook.com/fbmlessentials' label='Go there!'/>">
  <fb:multi-friend-selector showborder="false" 
      actiontext="Invite your friends to use FBML Essentials.">
</fb:request-form>

Here’s another example, this time using <fb:multi-friend-input/> and <fb:request-form-submit/>:

<fb:request-form action="index.php" method="POST" invite="true" 
    type="FBML Essentials" content="Hello Friend. <fb:req-choice 
    url='http://apps.facebook.com/fbmlessentials' label='Go there!'/>">
  <fb:multi-friend-input width="350px" border_color="#8496ba" 
      exclude_ids="4,5,10,15" />
  <fb:request-form-submit/>
</fb:request-form>

Rendered HTML for Single Instance of Tag

The first <fb:request-form/> example renders as shown in Figure 3-46.

The result of our first <fb:request-form/> example (using <fb:multi-friend-selector/>)
Figure 3-46. The result of our first <fb:request-form/> example (using <fb:multi-friend-selector/>)

The second <fb:request-form/> example renders as shown in Figure 3-47.

The result of our second <fb:request-form/> example (using <fb:multi-friend-input/>)
Figure 3-47. The result of our second <fb:request-form/> example (using <fb:multi-friend-input/>)

Additional Information

  • <fb:request-form/> returns an ids[] attribute with a comma-separated list of IDs that the invite was sent to. This attribute gets passed to the action attribute specified in the <fb:request-form/>.

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

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