title: pass arguments to ajax callback function in drupal 7 form api
body: <p>how to pass arguments to Ajax callback function in drupal 7 form api</p>
  
  <pre><code>$element['field name'] = array(
          '#type' =&gt; 'textfield',
          '#ajax' =&gt; array(
            'callback' =&gt; 'ajax_function_name_callback'/%/%/%,
            'method' =&gt; 'replace',
            'event' =&gt; 'blur',
                'effect' =&gt; 'fade',
                'progress' =&gt; array('type' =&gt; 'throbber', 'message' =&gt; ''),
          ),
      );
  
  function ajax_function_name_callback($form,$form_state)
  {
  return ..
  }
  </code></pre>
  
  <p>for example if i need to specify form element to make action using ajax i need to pass the element name to the function and make customer operation and return the result to another element form</p>
  
  <p>i need passed aruguments to this callback function 'callback' => 'ajax_function_name_callback' </p>
  
  <p>function ajax_function_name_callback($args1,$args2,...$form,$form_state) { return .. } </p>
  
  <p>2 - and how Through the form ? </p>
  
  <p>thanks..</p>
  
  <p>if i dont know what the $input_name it's genrated from something oprations i need to tell ajax_'function_name_callback the name of this field to make</p>
  
  <pre><code>$element[$input_name] = array(
          '#type' =&gt; 'textfield',
          '#size' =&gt; '41',
          '#ajax' =&gt; array(
  //////////////////////////////////////////////////////////////////////////////////
  // here how i tell the ajax call back about this arguments informationvlike parents of this field ... etc
  /////////////////////////////////////////////////////////////////////////////////
                'callback' =&gt; 'ajax_'function_name_callback',
            'method' =&gt; 'replace',
            'event' =&gt; 'blur',
                'effect' =&gt; 'fade',
                'progress' =&gt; array('type' =&gt; 'throbber', 'message' =&gt; ''),
          ),
      );
  
  
  function ajax_'function_name_callback($arg_position,$arg_fieldName,$form,$form_state)
  {
  $form[$arg_position][$arg_fieldName][#value] = anotherFunction($form[$arg_position][$arg_fieldName][#value]);
  return $form[$arg_position][$arg_fieldName];
  }
  </code></pre>