Using Forms in FaceBox

264 views
Skip to first unread message

Bianca

unread,
Aug 25, 2009, 2:39:14 PM8/25/09
to facebox
Hello,
I'm a newbie trying to use a form with facebox but cannot figure out
how to keep the facebox window open after clicking submit.I searched
the group (and the web) and cannot find a specific answer to this.
Here is what I have going on:

- I have a standard index.html page with all the facebox references
- From this page, I have a link that opens up an exterior file in the
facebox window: contact.html
- My contact page is basic HTML with a form post action of
"process.php"
- The process.php file has the form submission code as well as the
success message.

What I want to do is open contact.html in the facebox window (which
works fine) but after clicking the submit button, I would like to load
"process.php" in the facebox popup window (either the same one or a
new one).

Does anyone have a link or specific instructions on how to do this? I
am a JS/Ajax beginner so I have no clue where to even start.

Thanks in advance


Josiah Kiehl

unread,
Aug 25, 2009, 2:47:15 PM8/25/09
to fac...@googlegroups.com
You're going to have to submit the for via Ajax.

Remove the action from your form and set up your button to do an ajax call onclick:

onclick="submitContactForm(); return false;"

function submitContactForm() {
  $.post('process.php', { field1: $('#field1').val(), ... fieldn: $('#fieldn').val() }, function(data){ $.facebox(data); }
 });

Bianca

unread,
Aug 25, 2009, 3:43:44 PM8/25/09
to facebox
Thank you very much for your speedy reply Josiah! I really appreciate
the help :)

On Aug 25, 2:47 pm, Josiah Kiehl <bluep...@gmail.com> wrote:
> You're going to have to submit the for via Ajax.
>
> Remove the action from your form and set up your button to do an ajax call
> onclick:
>
> onclick="submitContactForm(); return false;"
>
> function submitContactForm() {
> $.post('process.php', { field1: $('#field1').val(), ... fieldn:
> $('#fieldn').val() }, function(data){ $.facebox(data); }
> });
>

Trienco Fransens

unread,
Aug 25, 2009, 4:44:23 PM8/25/09
to fac...@googlegroups.com
helllo was jou name

2009/8/25 Bianca <foxyb...@gmail.com>
Reply all
Reply to author
Forward
0 new messages