Search code examples
facebookfbjs

How to use Facebook FBJS Feed Forms


I'm trying to call a Feed Form in my Facebook application and I'm not sure how to do so. I'm not familiar with the FBJS and its API. Specifically I need the following dialogue to show up: http://wiki.developers.facebook.com/index.php/Feed_Forms

Here's what I got for now:

<script type="text/javascript">
var attachment = <?php echo json_encode($attachment); ?>;
return attachment;
Facebook.streamPublish(<?php echo $message; ?>, attachment, null, <?php echo $user; ?>);
</script>

Is there anything else I need to do in order to properly call a Feed form? A code example would help me a lot if anyone is willing to write one up.


Solution

  • For FBML canvas pages, all you need to do is execute the command as follows:

    <script type="text/javascript">
    
    var attachment = <?php echo json_encode($attachment); ?>;
    
    Facebook.streamPublish('', attachment, null);       
    
    </script>
    

    That should easily bring up the Feed Form.