I wonder if it's possible to get the values from two forms, if the forms are in two different blocks. I like to design a search page. The search page should have many option-forms for filtering the result. The search-page gets the xml-data from a solr-server, the option forms are sending users choice via REST to the solr-server. This works.

Now I want to use ajax. So I ask, how is it possible to retrieve the data of all forms, if the forms are in different blocks and different sidebars? Maybe the user choices on the size-block the sizes "L". The search-results shows all "L"-Nodes ... After this the user choices on the color-block "green" --> after this the search result should show all "L" with the color green as result.

=> Please, how I can collect via ajax all "form_stats" from all option-boxes of the site. The option boxes are in different blocks.


function facettenblock_block_view($delta = '') {
  switch($delta){

    case 'facetten_color': 
      $block['subject'] = t('COLOR');
      $block['content'] = drupal_get_form('solr_facettenblock_color_form'); 
    break;

    case 'facetten_size': 
      $block['subject'] = t('SIZE');
      $block['content'] = drupal_get_form('solr_facettenblock_size_form');
    break;

}


//content of blocks = forms with options

function solr_facettenblock_color_form($form, &$form_state) {

  $options = array(COLOR);
  $form['color'] = array(
    '#type' => 'checkboxes',
    '#options' => $options ,
    '#title' => 'color',
    '#ajax' => array(
      'event' => 'change',
      'callback' => 'search_result',
      'wrapper' => 'content',
      'effect' => 'fade',
     ),
  );  
  
return $form;
} 


function solr_facettenblock_size_form($form, &$form_state) {

  $options = array(SIZE);
  $form['size'] = array(
    '#type' => 'checkboxes',
    '#options' => $options ,
    '#title' => 'size',
    '#ajax' => array(
      'event' => 'change',
      'callback' => 'search_result',
      'wrapper' => 'content',
      'effect' => 'fade',
     ),
  ); 
  
return $form;
} 

// result of search (getting via XML) search page

function search_result ($form, &$form_state) {
  $result='<div id="content">';

  // sending the values from all "search boxes" to an solr-server
  // http://solor/?q=*+AND+color-choice+AND+size-choice
  // getting XML and parse xml with foreach

  foreach ($form_state['values']['color'] as $key=>$item) {
	if(!empty($item)) {$desc.='key: '.$key.' item: '.$item.'<br>';}
	
  }
  

  foreach ($form_state['values']['size'] as $key=>$item) {
	if(!empty($item)) {$desc.='key: '.$key.' item: '.$item.' k<br>';}
  }


  $out.=$result;
  $out.='</div>';


  return $result;
}