Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I think this question is not related to facebook or it's php sdk, but anyway, you can do it in so many ways I think. I do something like that in one app I just released:</p> <p>1) In the FB.ui method, add the max_recipients option, like this: FB.ui({ method: 'apprequests', message: 'My diaolog...', max_recipients: 1 });</p> <p>2) Remember that the ui method allows you to attach a callback to it, so you can do something like this: FB.ui({ method: 'apprequests', message: 'My diaolog...', max_recipients: 1 },function(response){ console.log(response) });</p> <p>In this response variable you have the ID of the user selected.</p> <p>What I do next is to populate a form using this response. I have a form with hidden fields like this:</p> <pre><code>&lt;form id="miform"&gt; &lt;input type="hidden" name="friend1" value="" id="f1"&gt; &lt;input type="hidden" name="friend2" value="" id="f2"&gt; &lt;input type="hidden" name="friend3" value="" id="f3"&gt; &lt;input type="hidden" name="friend4" value="" id="f4"&gt; &lt;input type="hidden" name="friend5" value="" id="f5"&gt; &lt;/form&gt; </code></pre> <p>With jquery, I populate the hidden inputs (remember, we're still inside the callback function):</p> <pre><code>$('#f1').attr('value',response.to[0]); </code></pre> <p>3) The last step is the validation, you can do it with javascript or php:</p> <pre><code>$('#myform').on('submit',function(){ // check if the fields are not empty and submit the form or alert if the fields are empty. }); </code></pre> <p>Hope this gives you a more clear view of what you have to do.</p> <p>Regards.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload