Issue implementing Ajax in form I created a basic page which has a basic form and implements ajax, or attempts to do so. My issue is that it doesn't seem to be functioning as it should. What might be Ajax, only works after I press enter in the textfield, which submits the data and refreshs the page, although I don't think it's ajax at work, rather the form functioning normally, I changed the #event to blur and the #keypress to false but everything is still entirely the same. Ultimately ajax isn't working, if anyone can clear this up that'd be grand.

&lt;?php
/**
 * @file
 *  Creates form page which implements ajax
 */  

/**
 * Implements hook_menu();
 */
function formajax_menu() {
    $items['formexample'] = array(
      'title' =&gt; 'Form Ajax Example',
      'description' =&gt; 'This is a page generated via hook menu 
                        which displays a form with ajax support',
      'page callback' =&gt; 'drupal_get_form',
      'page arguments' =&gt; array('formajax_form'),
      'access callback' =&gt; TRUE,
    );
    return $items;
 }  


function formajax_form($form, &amp;$form_state) {
  // create a fieldSet
  $form = array();
  $form['data'] = array(
      '#type' =&gt; 'fieldset',
      '#title' =&gt; t('Form Ajax Example'),
    );
 // Create textfield
    $form['data']['textinput'] = array(
      '#title' =&gt; t('Name'),
        '#description' =&gt; t('Your Name Here'), 
        '#type' =&gt; 'textfield',
      // add ajax property with callback and wrapper
      '#ajax' =&gt; array(
          '#callback' =&gt; 'formajax_callback',
          '#wrapper' =&gt;  'replace_this',
          '#effect'  =&gt; 'fade',
          '#event' =&gt; 'blur',
          '#keypress' =&gt; FALSE,
        ),
    );
    // create item dependant on textfield
    $ajax = (!empty($form_state['values']['textinput'])) 
             ? $form_state['values']['textinput'] : 'John';
    $form['data']['ajax_response'] = array(
      '#type' =&gt; 'item',
      '#title' =&gt; t('Ajax Response'),
      '#markup' =&gt; t('Your Name is' . $ajax),
      // prefix item with div id of wrapper
      '#prefix' =&gt; '&lt;div id="replace_this"&gt;',
      '#suffix' =&gt; '&lt;/div&gt;',
    );
    return $form;
 }
// create callback which will return data
function formajax_callback($form, &amp;$form_state) {
    return $form['data']['ajax_response'];
}
Take the #'s off the nested #ajax values.  IE

  '#ajax' =&gt; array(
      'callback' =&gt; 'formajax_callback',
      'wrapper' =&gt;  'replace_this',
      'effect'  =&gt; 'fade',
      'event' =&gt; 'blur',
      'keypress' =&gt; FALSE,
    ),