Search code examples
facebookfbmlfbjs

'showing' a facebook fb:dialog


i want to use facebook's fb:dialog tag to display a simple pop-up form for the user to fill in. but i want to show that dialog using javascript (in the ondone handler of an ajax request).

is this possible? i took a stab in the dark and tried document.getElementById('dialog_id').show() but show() is not a method.

alternatively there is the FBJS Dialog class but as far as i can tell you can only use it to create simple alert/confirm style dialogs. if someone knows of a way to put arbitrary content in them then that may also solve my problem.


Solution

  • You can put arbritrary content inside of an FBJS dialog box.

    First, store some arbitrary fbml in an fb:js-string tag:

    <fb:js-string var="whatever">
    <!-- HTML/fbml here -->
    </fb:js-string>
    

    then in fbjs do:

    (new Dialog()).showMessage('title',whatever);