Talk:FeedStory form
From Facebook Developer Wiki
Why is no mention made here of the need to REGISTER templates?
The current example for this page is horribly wrong.
- Yeah, doesn't match up to the feed forms page at all. - 193700405 10:00, 30 September 2008 (PDT)
next_fbjs doesn't appear to do anything. If I create a form with fbml like this...
<form fbtype="feedStory" next_fbjs="dosomething()" action="http://mysite/"> blah blah <input type="submit" label="Publish" /> </form>
It comes out like this:
<form fbtype="feedStory" next_fbjs="dosomething()" action="http://mysite/" id="feed_form_48ebe613889c38f60743602"> blah blah <input type="button" class="inputbutton" onclick="return new FeedForm().setForm($("feed_form_48ebe613889c38f60743602")).setAppId("26508422863").show();fb_protected="true";" id="publish" name="publish" value="Publish" /> </form>
Note that the code inside next_fbjs is not rewritten into fbjs (I'd expect "dosomething" to prepended with the app id, as usual.) Does next_fbjs as a feed forms option work? 12542 15:45, 7 October 2008 (PDT)
Question: Is there a way to conditionally send out the Form Feed? In other words, is there a way to have a check box in a form control whether or not the user receives the Publish prompt? 15:16, 15 October, 2008 (PDT)
[edit] 28 November 2008 - I have tried this example and keep getting back two errors:
1. Using the first example it returns a "...sent invalid response" error : "Expecting method feedStory Received method publish". So I changed the callback to return "feedStory" as the method. 2. Once this change was made I get another "invalid response" error : "Missing template id for feed story"
Can someone please post a complete example that actually works?? I am finding Facebook development VERY frustrating...
_____________
First go create a template bundle and grab its id. Do this using the developer application. Then, this works, ruby on rails:
class FeedsController < ApplicationController
def thing_complete()
thing=Thing.find(params[:id])
render :json=>{"content" =>
{"feed"=>
{ "template_id"=> #insert your template bundle id#,
"template_data"=> { "thing_text"=>thing.text,
"other_content_for_your_template"=>""
}
}
},
"method"=>"feedStory"
}
end
end
Then in the view:
<form fbtype="feedStory" action="<%=ActionController::Base.asset_host%>/feeds/thing_complete">
<input type="hidden" name="thing_id" value="<%=@thing.id%>" /> <input type="submit" value="Publish" label="Publish my progress" />
</form>
[edit] "Skip" button yields same action as "publish" button
Both when the user clicks the "publish" button and the feedStory is submitted, or when he clicks the "skip" button and the feedStory is not submitted, the "next" action is exactly the same, and the corresponding action page receives exactly the same GET and POST vars. This simply means that I cannot find out whether the user actually submitted the feedStory or not. Or is there any other way?
- Facebook doesn't provide information as to whether a story gets published or skipped. This is to prevent applications from rewarding or incentivizing users for publishing stories. -- Pete (563683308 11:27, 16 June 2009 (PDT))
- Pete, thanks anyway for the answer. I see the point. But maybe it would be better if this restriction would be conditioned on whether the *application* initiated the publication of the story, or whether the *user* initiated it. In my case, I allow users to publish content from the application to their wall, by simply clicking a button next to the content. However, I would like to show them which content they already published and which content they didn't publish, yet. But with that restriction, such a service is not feasible. -- Ben
- Hi Ben, have you thought about using stream.publish instead? This way, once you get the publish_stream extended permission, you can publish directly to the user's Wall and News Feed (stream), without prompting the user. Then you won't have to show the user what your app has or hasn't published (or if you want, you can always call stream.get, filter for your app ID, and show the user what your app has already published). The thing about Feed forms is that they're always supposed to be in response to an action a user takes in an application, so in a sense, they're always user initiated. Does this make sense? -- Pete (563683308 14:01, 17 June 2009 (PDT))
