Here, I am working in drupal Commons plugin. I already customized search form in that drupal header.Here i include modify search form in custom theme:
function mytheme_form_alter(&$form, &$form_state, $form_id) {
if ($form_id == 'search_block_form') {
$form['search_block_form']['#title'] = t('Search'); // Change the text on the label element
$form['search_block_form']['#title_display'] = 'invisible'; // Toggle label visibilty
$form['search_block_form']['#default_value'] = t('Search'); // Set a default value for the textfield
$form['custom_search_types']['#attributes'] = array('style' => 'display:none'); // Set a default value for the textfield
$form['search_block_form']['#attributes']['class'][] = 'form-control'; // Set a default value for the textfield
$form['actions']['submit']['#value'] = 'OK!'; // Change the text on the submit button
$form['actions']['submit'] = array('#type' => 'button','#value' => 'OK!');
// Add extra attributes to the text box
$form['search_block_form']['#attributes']['onblur'] = "if (this.value == '') {this.value = 'Search';}";
$form['search_block_form']['#attributes']['onfocus'] = "if (this.value == 'Search') {this.value = '';}";
// Prevent user from searching the default text
$form['#attributes']['onsubmit'] = "if(this.search_block_form.value=='Search'){ alert('Please enter a search'); return false; }";
$form['actions']['submit']['#attributes']['class'][] = 'input-group-addon';
// Alternative (HTML5) placeholder attribute instead of using the javascript
$form['search_block_form']['#attributes']['placeholder'] = t('Search');
}
}
And i need to redirect search result page using that above search form.But I type content and hit enter it remain same page.How to redirect into search result page with custom form values.I just customized form submit in custom theme
function mytheme_search_box_form_submit($form, &$form_state) {
print_r($form);//No results
}
How to achieve it. kindly guide me..