drupal ajax web form

Posted on 2010-08-18
Last Modified: 2012-05-10
i have web form and web form block modules installed

how do i apply ajax to the form?
Question by:charmingduck
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
LVL 17

Expert Comment

ID: 33472168
This module can do it, Never used it before though.

Author Comment

ID: 33472210
i tried it with web form and web form block, didnt work, any ideas?
LVL 17

Expert Comment

ID: 33472322
Look at this page,,  under "Find the form ID". You'll need to find the id of your webform block form.

Then put the following code snippet in your theme's template.tpl.php (sounds familiar?). Replace THEMENAME, and YOUR-FORM-ID with your values.
THEMENAME_form_alter(&$form, $form_state, $form_id) {
  if($form_id == 'YOUR-FORM-ID') {
    $form['#ajax'] = array(
      'enabled' => TRUE

Open in new window

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button


Author Comment

ID: 33472345
I used the ajax module and it broke my site,,,

but after i disabled it, everything's back to normal...
LVL 17

Accepted Solution

Thomas4019 earned 500 total points
ID: 33472372
hmmm, well the ajax module is the way to get this done. I would recommend uninstalling the module (at And then re-enable the module. Then go to admin/settings/ajax and turn off ajax for every form. This way it shouldn't break your site. then you can follow my instructions above. If you run into problems googling "hook_form_alter" might help.

Author Comment

ID: 33472384
any difference between uninstall a module and simply uncheck it?
LVL 17

Expert Comment

ID: 33477528
Yes, unchecking disables the module, uninstalling removes all data related to that module. So that way when you enable it again you get a fresh start. Some modules can't be uninstalled because they don't create any data to remove.

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Cut off Acquia Search and use our own settings? 2 400
Capture User Email Address and Role? 1 55
Drupal Converting Time 1 118
How do I edit this Drupal page? 9 79
This article is for those that are having major problems with users upload files such as pictures to their profile. The solution is simple and has to do with correcting the directory paths. With some experimenting and testing i got it fixed. Note…
RTL (right to left) web applications aiming for audiences speaking languages like Hebrew or Arabic, are generally more complicated than the same applications aiming for audiences speaking Latin based languages. The main difference lies of course …
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question