I've got an exposed filter on one of my views which has the standard "apply" button. I'm wondering if there is a way to change the text on the button so that it says something other than "apply".

Comments

webthingee’s picture

I was looking for some options for this as well and here are three resources that I found and used a combination of each....

http://fleetthought.com/blog-post/adding-reset-button-exposed-views-filters
http://stackoverflow.com/questions/451745/drupal-views2-exposed-form-how...
http://api.drupal.org/api/function/hook_form_alter

-=Sean=-

SeanBannister’s picture

TravisCarden’s picture

Specifically, see Comment #10 for instructions on doing this with a custom module and Comment #24 for doing it in your theme, and don't overlook Views' own views-exposed-form.tpl.php if you can do what you want with a template.

sachinwable’s picture

Hi here is the solution for your query

http://www.learn-drupal.in/drupal/how-to-change-apply-button-text-in-dru...

Thanks,
Sachin

jeovani33’s picture

I found it using CSS Only, and the good thing about CSS is that you can change the button text differently for different pages, which I was looking for.

The whole concept is to create a graphic background with the "text" you want the button to have and assign it as a background to the button. As well you have to minimize the text of the "apply button" to 1px or 0px(0px might be incompatable with some browser, check before) with the same kackground color as the grapfic you created.

something like this:

.views-exposed-widget .form-submit{
background:url(your/background.jpg) no-repeat;
font-size:1px
font-color: your-color;

}

Web Design In London

Regards

John

snehi’s picture

make a custom of this type

<?php

// $Id: template.php,v 1.4.2.4 2010/08/13 22:16:52 troy Exp $
function themename_preprocess_views_exposed_form(&$vars, $hook)
{
// change the id of form replace it with views-exposed-form-davinder-page-1
if ($vars['form']['#id'] == 'views-exposed-form-davinder-page-1') {
// Change the text on the submit button
$vars['form']['submit']['#value'] = t('Search');
// change the apply button to search
// Rebuild the rendered version (submit button, rest remains unchanged)
unset($vars['form']['submit']['#printed']);
$vars['button'] = drupal_render($vars['form']['submit']);
}
}

snehi’s picture

make a custom of this type

// $Id: template.php,v 1.4.2.4 2010/08/13 22:16:52 troy Exp $
function themename_preprocess_views_exposed_form(&$vars, $hook)
{
// change the id of form replace it with views-exposed-form-davinder-page-1
if ($vars['form']['#id'] == 'views-exposed-form-davinder-page-1') {
// Change the text on the submit button
$vars['form']['submit']['#value'] = t('Search');
// change the apply button to search
// Rebuild the rendered version (submit button, rest remains unchanged)
unset($vars['form']['submit']['#printed']);
$vars['button'] = drupal_render($vars['form']['submit']);

LaurenW’s picture

If anyone is searching for how to do this in Drupal 7, I found it under Advanced, in the "Exposed form style" settings. No special coding or CSS required!

only4kaustav’s picture

Can you please help to find this, I have not found in Views->Settings->Advance

juanjo4’s picture

This works for me! Thanks.

rohan chopra’s picture

Views Advanced Setting
Exposed form style:Setting

Submit button text *
Change "Apply"

OFF’s picture

Thank you!

bigga’s picture

That is very easy. Thx a lot!

leoklein’s picture

Thanks!

rlujano’s picture

Thanks!!!

Arne Slabbinck’s picture

Thanks! ^^

M.Castro’s picture

It also works in Drupal 8. Thanks a lot!!!

leoklein’s picture

Thanks!