So, at this point we have a nice-looking form that presents a list of items and allows the user to select a Friend... but it would be nice if the application could pass that information back to us, yeah? Do you remember the server-side button buttonSend I had:
When the user clicks on this button, the page supposed to a) check user input, i.e. if a Friend is entered and b) submit the information back. Let's check user input when the form is about to be submitted. On the ASPX page, I added JavaScript (FBJS):
]]>
...and in the code:
If input passes the validation check (in this example, we only check if the user selects/enters a Friend), then the page is submitted and we have a chance to save selected data into the database. Hooray!
* Notice the reference to the Page.Request.Form["textSelectedFriend"] form field from the element. No, we didn't create this element on the page. Instead, the Facebook platform added it "dynamically." You can also use other types of Dialogs, for example, DIALOG_CONTEXTUAL:
To display such s CONTEXTUAL dialog, we can use "inline" JavaScript (FBJS):
...or, to display a POPUP: