0

this is what I am using to override the Search module's submit button's CSS ID:

function hook_form_alter(&$form, &$form_state, $form_id) {
    if ($form_id == 'search_block_form') {
        $form['actions']['submit']['#attributes']['id'][] = 'custom_css_id';
    }
}

Now I want same thing for the textfield input.

2

It is the same thing as you did above

$form['search_block_form']['#attributes']['id'][] = 'custom_css_id';
4
  • I always wondered why they called that input 'search_block_form', it's very confusing – Clive Jan 29 '13 at 16:06
  • 2
    @Clive the other day the same question came to my mind as well. Why would they give the input field the same name as the form id or the block name. :) – junedkazi Jan 29 '13 at 16:11
  • Wooow thanks for fast reply. I gotta bookmark this website. Yes I knew it had to be same thing but since I am just a designer this all drupal theming is really hard for me. It worked, thanks a lot. But now do you know how do I disable that element.style the input gets? It overrides my color. I cannot edit CSS, I know I could set !important. – user13176 Jan 29 '13 at 16:20
  • @user13176 I would suggest you should have a look at the devel module drupal.org/project/devel and its docs. It will help you in the future to debug stuff like this one. – junedkazi Jan 29 '13 at 16:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.