Webform

Events happening in the community are now at Drupal community events on www.drupal.org.
nlambert's picture

Hi,

I'm trying to have webforms appear in thickbox and dissapear after submission using the Ajax Plugin.

I am using the three following plugins :

ajax 6.x-1.14
webform 6.x-2.9
thickbox 6.x-1.6

Having the form appear is no problem. However I notice the following :

1. If a "Confirmation Message" in the "Webform Settings" has been added, the Ajax "Remove Form After Submit" does not seem to work any longer. This might be the fact that Webform handles the "confirmation message" in a different manner than other messages using webform-confirmation.tpl.php.
2. After form submission, the form dissappears, but not the Thickbox modal.

For testing purposes (concerning my second point only) I added an extra option (auto_close) to the Ajax Redirect plugin and added the following js :

28. if (args.options.auto_close === true) {
29. setTimeout('tb_remove()', 4000);
30. }

It works, but I'm not a programmer and probably went at this incorrectly... and maybe my aweful hack is unnecessary.

What would be nice is to have the Webform removed as per the Ajax plugin, the Webform Confirmation Message appear and the Thickbox modal dissappear after a short delay allowing the user to read the Webform Confirmation Message.

Any thoughts?

Cheers

Comments

First Point

nlambert's picture

I guess my first point must be related to this patch http://drupal.org/node/518970

try...

scotjam's picture

Hi modesia

Try looking into how the login and register pages are made as 'popups' here...

http://drupal.org/project/ajax_register

You may be able to use the same same technique for webforms

cheers
scotjam

modal API

emptyvoid's picture

You may also consider the Modal Frame API

http://drupal.org/project/modalframe

There are several contributed modules utlizing the modal frame Api that may provide great examples.
http://drupal.org/project/modalframe_contrib

Robert Foley Jr
Solutions Architect
http://www.robertfoleyjr.com

same issue for modalframe

mikou's picture

I'm reopening this subject as I'm trying to accomplish the same thing with a modalframe. It is a bit of the same issue !
What I figured out :

my hook_menu :

        $items['path/form'] = array(
                'title' => t('Comment'),
                'page callback' => 'id_form_page',
                'access callback' => TRUE,
                'type' => MENU_CALLBACK,
        );
        $items['path/close'] = array(
                'title' => t('Thank you for your comment'),
                'page callback' => 'id_form_page_close',
                'access callback' => TRUE,
                'type' => MENU_CALLBACK,
        );

        return $items;

A page in which I integrate my webform :

function id_form_page() {
        modalframe_child_js();
        $node = node_load(4);
        return node_view($node, $teaser = FALSE, $page = TRUE, $links = FALSE);
}

A second page to handle the function modalframe_close_dialog() :
Then, I set my form to redirect to this page in the form settings page (/node/%/webform/configure)

function id_form_page_close() {
        modalframe_child_js();
        modalframe_close_dialog(array(
                'message' => t('Merci'),
        ));

        return FALSE;
}

It is certainly very nasty. But couldn't figure out how to alter the submit function.
If somebody has a better solution, I'll be happy to hear about it.

Ajax.module

Group organizers

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: