views:

285

answers:

1

I have an FBML canvas app and I have a few places that I currently display forms in their own pages, but we'd like to move these to dialogs.

So, could someone give an example of using a link to popup a dialog with a form in it and handling the submission of that form in the controller?

A: 

I have been using Facebox to handle my dialogues. The advantage of this is that you don't need to change your code at all - the form is still in the page and submits to the same controller, but JavaScript handles the presentation in the page as a dialogue.

If you are in the canvas, you can have a look at using the built-in Dialog FBML, which is essentially the same principle.

Toby Hede
thx for that idea... maybe that can work, but how does a jquery based solution integrate w FB? I thought that most JS libs dont work that well for FBML FB apps?in any case, could you show me some code or pt me to somewhere that shows how it sends form params to the controller? that's the part that I cant seem to get right on my own and cant find an example of?
lunaclaire
The form would work like any other Rails form and controller - you either use the built-in form builder and pass it URL parameters or a named route, or set the form action to be the required path. Is there a particular error that you are receiving?
Toby Hede
I guess because I havent done popup dialogs b4 and I'm not used to dealing with a form and the post to the controller from JS, I'm struggling with a couple things:1) I'm doing something wrong re: ajax posting back to the controller from the JS2) because of the first thing, I havent been able to establish that I'm doing the right thing in gathering the params from the form fields... I've got this: var ajax = new Ajax(); ajax.responseType = Ajax.FBML; ajax.requireLogin = true; ajax.post(targetURL,document.getElementById('newReplyForm').serialize());seeing some code might help me
lunaclaire
sorry about the formatting above
lunaclaire