Feed Forms

From Facebook Developer Wiki

(Redirected from Feed forms)
Jump to: navigation, search

Feed forms are special FBML components that allow applications to publish Feed stories on behalf of users. There are two types of Feed forms:

  • feedStory, which you use to publish stories onto the current user's Wall.
  • multiFeedStory, which you use to publish stories onto the Wall of the current user's friend.

You create a Feed form using a standard HTML <form> tag marked with a special fbtype attribute. The rest of the form works exactly like a normal HTML form. Feel free to put whatever elements you need to collect information, to create the object behind the story.

<form fbtype="feedStory" action="http://my.canvas.com/feed_handler.php"> <input type="text" name="status" /> <input type="submit" value="Publish" label="Publish" /> </form>


When the user submits the form, Facebook does some special handling of the form behind the scenes (similar to how we handle fb:request-form). We intercept the submission and pass it along with the form data to your action attribute. Instead of sending back FBML, your application should send back a JSON response with the Feed story (and its registered bundle). A basic response is a simple title and body.

{"content": {"feed": {"template_id":55555555, "template_data": {"status":"status"} } }, "method":"feedStory" }


Once the data is returned we display a preview to the user and give the user the option of publishing the story.

Your application also has the option of blocking the Feed story because of validation or other data issues. If we receive an error code, then we let you display an error message.

{"errorCode": 1, "errorTitle" : "Status Error", "errorMessage" : "That status was not very exciting" }


[edit] FBJS and IFrame Feed Forms

There are also FBJS and iframe versions of Feed forms.

reference