0

I have a form that is using ajax to filter from a dropdown to another dropdown and then I have ajax setup on the submit button to submit the whole form via ajax.

Everything works fine in the main module page, but the ajax does not work on other module pages.

I don't see any javascript errors in the console, and it seemed that all the javascript files related to drupal's ajax were loaded with the page.

What could the problem be?

Thanks!

Update:

I am using Drupal 7.9. The code that I am using to submit the form in ajax is:

$form['submit'] = array(
        '#type' => 'submit',
        '#value' => t('Transfer'),
        '#submit' => array('ajax_create_transaction_submit'),
        '#ajax' => array(
            'callback' => 'ajax_create_transaction_callback',
            'wrapper' => 'user_transfer_panel',
            'effect' => 'fade',
            'progress' => array(
                'type' => 'throbber',
                'message' => t('Processing transfer. Please wait...'),
            ),
        )
    );

This code is working but only on 1 page within my module.

2
  • Drupal version?
    – Chapabu
    Commented Dec 22, 2011 at 14:44
  • can you show us some javascript code? Commented Dec 22, 2011 at 16:11

1 Answer 1

1

So the problem was that I have various pages in my module which are each separated in their respective files e.g. mymodule.module, mymodule.page2.inc, mymodule.page3.inc etc

The issue was that the form of the block was in mymodule.page2.inc so when the user navigated to page3 the methods of the form where not being loaded.

The solution was to copy all the form methods into mymodule.module since it is like the parent of all the pages, so then the methods were accessible from all the pages.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.