What is the easiest way to view current $form_state variables while working with #ajax?

Is there a way I can get dpm() to update automatically on each AJAX load?

If it matters, I'm testing AJAX on a Node Submit form.

5 Answers 5


Using dd($form_state); within the callback function works beautifully.

On linux you can tail -f /tmp/drupal-debug.txt to see the $form_state in real time. (Or whatever the temp directory for your site is set to, often something like sites/yoursite.com/files/tmp.)

Otherwise, you can find drupal-debug.txt in your systems /tmp/ directory. http://ratatosk.net/drupal/tutorials/debugging-drupal.html#dd


The best thing I've found: https://drupal.org/project/devel_debug_log

Part of/depends on Devel and uses ddl to output anything in kpr fashion at admin/reports/debug.

  • 4
    This module is really useful - thanks for the suggestion
    – Felix Eve
    Feb 5, 2014 at 10:35

I was also having problems with finding a good way to debug AJAX with the Form API and found debugging with FirePHP to be the best solution:



You could also try with something like this, and looking into the response tab on FireBug:

function _exit($var) {

Chrome developer console can help a lot.

  • Open the page where you fire up the ajax call
  • Open Chrome developers tools
  • Click tab "Network"
  • Click the below "preview" tab
  • Clean all current records
  • Open a page with autocomplete field
  • Fire up the ajax (IE: push submit buttom)
  • Check output

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.