Tell me more ×
Drupal Answers is a question and answer site for Drupal developers and administrators. It's 100% free, no registration required.

I already have a form which obviously it has a submit button. For searching i'm using Search API module with Views Integration. I have set my view and everything seems to be working, but my problem is that i do not know how to integrate the search form to use that view. I mean if i type anything in the input box the results it is the same , no result and if i go to the view page and type something , everything seems to work just fine.

Altered form :

$form['#attributes']['class'][0] = '';
  $form['basic']['keys'] = array(
    '#prefix' => '<div class="choose_from"><ul>',
    '#suffix' => '',
    '#attributes' => array('class' => array(''))
  );


  $form['basic']['processed_keys'] = array(
    '#type' => 'value',
    '#value' => array(),
  );


  $form['basic']['keys']['category'] = array
  (
    '#prefix' =>'<li><label class="label_check" for="category">',
    '#suffix' =>'Category</li></label>',
    '#type'=>'checkbox',
    '#value' =>'0',
    '#id'=>'category',
    '#name' =>'category'
  );
  $form['basic']['keys']['position'] = array
  (
    '#prefix' =>'<li><label class="label_check" for="position">',
    '#suffix' =>'Position</li></label>',
    '#type'=>'checkbox',
    '#value' =>'0',
    '#id'=>'position',
    '#name' =>'position'
  );
  $form['basic']['keys']['division'] = array
  (
  '#prefix' =>'<li><label class="label_check" for="division">',
    '#suffix' =>'Division</li></label>',
    '#type'=>'checkbox',
    '#value' =>'0',
    '#id'=>'division',
    '#name' =>'division'
  );
  $form['basic']['keys']['grade'] = array
  (
  '#prefix' =>'<li><label class="label_check" for="grade">',
    '#suffix' =>'Grade</li></label></ul></div>',
    '#type'=>'checkbox',
    '#value' =>'0',
    '#id'=>'grade',
    '#name' =>'grade'
  );

  $form['basic']['keys']['search_string'] = array
  (
    '#prefix' => '<div class="search_title">',
    '#suffix' => '</div>',
    '#type'=>'textfield',
    '#attributes' => array('onfocus' =>'if(this.value==\'What you looking for?\') this.value=\'\';',
    'onblur'=>'if(this.value==\'\') this.value=\'What you looking for?\';','class' => array('no-form-text')) ,
    '#value' =>t('What you looking for?')
  );

  $form['basic']['submit'] = array(
    '#prefix' =>'<div class="search_action">', 
    '#suffix' => '</div>',
    '#type' => 'submit',
    '#value' => t('Search')
  );
share|improve this question

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.