Trigger ajax callback from input field webform I have a form build with the webform module. When text is entered in the input box in this case webform component 2 I want it to execute a ajax function and put data in a div. However this is not working at the moment. When i connect the ajax to $form['actions']['submit'] it does work.But i want it to be stuck to the input box not the submit function. The function is placed in the hook_form_alter.

$form['#node']-&gt;webform['components'][2]['#ajax'] = array(
  'callback' =&gt; 'callback function',
  'wrapper' =&gt; '#foo',
  'method' =&gt; 'replace',
  'effect' =&gt; 'fade',
);
I figured out you cannot attach ajax to webform components you need to add them to $form['submitted']

$form['submitted']['TEXTFIELDNAME']['#ajax'] = array(
  'callback' =&gt; 'callback function',
  'wrapper' =&gt; '#foo',
  'method' =&gt; 'replace',
  'effect' =&gt; 'fade',
);