Ajax drop down list problem with callback I need a little help here.
In a custom module, I add a little form where you type your zip code, press a button and a drop down list populates (via ajax) with the stores that are close to that zip code so you can choose one of them. The problem is when you click on that button the callback is made but the zip code field remains empty, seems like I missing something that can bring the zipcode value to that part when the  refreshes.
some ideas?? thank you

    function mymodule_form($form, &amp;$form_state) {

       $form['zip_code'] = array(
        '#type' =&gt; 'textfield', 
        '#title' =&gt; 'zip code',
        '#size' =&gt; 5,
        '#maxlength' =&gt; 5,
        '#required' =&gt; TRUE
      );

      $form['button'] = array(
        '#type' =&gt; 'button', 
        '#value' =&gt; 'find stores',
        "#limit_validation_errors" =&gt; array(),
        "#name" =&gt; 'mybutton',
        '#ajax' =&gt; array(
          'callback' =&gt; 'reload',
          'wrapper' =&gt; 'stores-div',
          'method' =&gt; 'replace',
          'effect' =&gt; 'fade'
        )
      );
      $form['select_str'] = array(
        '#prefix' =&gt; '&lt;div id="stores-div"&gt;',
        '#suffix' =&gt; '&lt;/div&gt;'
      );
      if(isset($form_state['values']['zip_code'])) {
        $arr = find_store($form_state['values']['zip_code']); //here is my main problem, $form_state['values']['zip_code']is always empty even after the callback 
      } else {
        $arr[99999] = 'theres none';
      }
      $form['select_str']['stores'] = array(
        '#type' =&gt; 'select', 
        '#title' =&gt; 'stores near you:',
        '#options' =&gt; $arr,
        '#required' =&gt; TRUE
      );
      $form['submit_button'] = array(
        '#type' =&gt; 'submit',
        '#value' =&gt; t('Send!'),
      );
      return $form;
    }
    function find_store($zc) {
        $fields = array(
                'zc'=&gt;urlencode($zc),
            );
        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL,"http://somepage.php");
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($ch, CURLOPT_POSTFIELDS, $fields);
        $result=curl_exec ($ch);
        curl_close($ch);
        $arr = array();
        if($result!='none') {
            $explode=explode(',',$result);
            foreach($explode as $value) {
                $stores = explode('|',$value);
                $arr[$stores[0]] = $stores[1];

        }


    } else {
        $arr[99999] ='theres none';
    }
    return $arr;

}
function reload($form, &amp;$form_state) {
  return $form['select_str'];
}
The values will be passed to the callback function reload instead of the original form function, therefore you should rebuild the form in your callback function - reload and pass back the element:

function reload($form, &amp;$form_state) {
  $form_state['rebuild'] = TRUE;
  $form = drupal_rebuild_form('mymodule_form', $form_state, $form);
  return $form['select_str'];
}