Home kellton

Main navigation

  • Services
    • Digital Business Services
      • Digital Experience
        • Product Strategy & Consulting
        • Product Design
        • Product Management
      • Product Engineering
        • Digital Application Development
        • Mobile Engineering
        • IoT & Wearables Solutions
        • Quality Engineering
      • Data Engineering & AI
        • Data Engineering
        • Data Science & ML
        • Generative AI & ChatGPT
        • Visualisation & Analytics
        • Integration & API
        • RPA
      • Cloud Engineering
        • Cloud Consulting
        • Cloud Migration
        • Cloud Managed Services
        • DevSecOps
      • NextGen Services
        • Blockchain
        • Web3
        • Metaverse
    • SAP
      • SAP Services
        • S/4HANA Implementations
        • SAP AMS Support
        • SAP Automation
        • SAP Security & GRC
        • SAP Value Added Solutions
        • Other SAP Implementations
  • Platforms & Products
    • Kellton4Health
    • Kellton4NFT
    • Kellton4Commerce
    • KLGAME
    • tHRive
    • Optima
  • Industries
    • Fintech, Banking, Financial Services & Insurance
    • Retail, E-Commerce & Distribution
    • Pharma, Healthcare & Life Sciences
    • Non-Profit, Government & Education
    • Travel, Logistics & Hospitality
    • HiTech, SaaS, ISV & Communications
    • Manufacturing, Automotive & Chemicals
    • Oil,Gas & Mining
    • Energy & Utilities
  • Insights
    • Blogs
    • Brochures
    • Success Stories
    • News / Announcements
    • Webinars
    • White papers
  • Careers
    • Life At Kellton
    • Jobs
  • About
    • About Us
    • Our Partners
    • Our Leadership
    • Testimonials
    • Investors
    • Privacy-Policy
    • Contact Us
Search

Breadcrumb

  1. Home
  2. Blogs
  3. Drupal 7 - Searching multiple fields in views u...

Drupal 7 - Searching multiple fields in views using combine fields filter

Product Engineering
March 26th , 2013
Posted By:
Kellton
linkedin
Drupal 7 - Searching multiple fields in views using combine fields filter

Related Post

How blockchain-driven innovations can transform global supply chains
Blog
Breaking down barriers: How blockchain-driven innovations can transform global supply chains?
25 May, 2023
Generative AI and ChatGPT
Blog
Redefining the game: Generative AI and ChatGPT unlock new possibilities across industries
11 May, 2023
android testing frameworks
Blog
Best Android automated app testing frameworks in 2023
08 May, 2023

For drupal development, it is required to display content using Views. Drupal allows us to create content with content type on our website. Content created in these content types can be displayed in various formats on drupal website with the help of views module. Sometimes, it is required to allow users to filter the content according to the fields available in content type and this functionality is provided by view exposed filters. In this blog, we will see what happens when end user is allowed to search multiple fields with single search field in view display page.

 

Let's create 'Event' content type which stores details of upcoming drupal events with field titles, details, start date, end date, contact person and email. Now, we need to show all events created in the site. For this, we create a simple view which shows list of content posted in event content type. Make sure that you choose fields in display format while creating the view. Below are basic settings of the view which you need to choose at the time of creating this view.

 

views1.jpg

 

This will provide us with a simple list of all events posted under event content type. Now, we will add search filter which allows user to search content in this view according to multiple fields with single search box.

 

For this, add another filter called 'Global: Combine fields filter'.

 

views2.jpg

 

In filter configuration form follow the instructions given below:

 

1. Check "expose this filter to visitor" checkbox and in 'operator' field.

2. Select 'contains' to search text.

3. In 'Choose fields to combine for filtering' field, select fields which you want your users to base their search on. Right now we want the user to search for event according to title and body.

 

views3.jpg

After applying this exposed filter, we will get a search box on top of the view display page and with this search box we can search content listed in the view.

 

One of the best uses of global combine fields filter is when we want to search a particular type of content from a search block on one of the regions on the site. For this, in views advanced area there is an option called "Exposed form in block:" Set this option to "yes" and save the view. Now go to blocks listing, there will be a new exposed form block with same name as your view. Assign this block a region so that views exposed search box will show up in selected region.

 

views4.jpg

 

Now, you will see that your search filter is shifted from views top region to your selected region. This search block is available on whole site, so it can work as global search for only events in the site. If we search 'London' in search box from any page of the site, it will take us to the upcoming Drupal events view page with search results of events content which contain 'London' text in its title field or body field.

 

views5.jpg

 

As you can see in above screen shot that for better usability, I changed block name to 'Search Upcoming Events' from block configuration and 'Filter' button to 'Search' button in views exposed form style settings. With global combine fields filter, we can add more exposed fields filter criteria for detailed search. It also allows us to create different search blocks for different type of content.

Posted By:
Kellton
linkedin

Want to know more?

android testing frameworks
Blog
Best Android automated app testing frameworks in 2023
08 May, 2023
Blog image
Blog
10 Best Backend Web Development Frameworks for 2023
17 Apr, 2023
Blog image
Blog
What is Kubernetes? Discover the top 3 Kubernetes trends on the rise in 2023
20 Mar, 2023

Leading you through Digital Transformation journey

North America: +1.844.469.8900

Asia: +91.124.469.8900

Europe: +44.203.807.6911

Email: ask@kellton.com

Footer menu right

  • Digital Experience
  • Data Engineering & AI
  • Nextgen Services
  • About
  • Contact

Footer Menu Left

  • Product Engineering
  • Cloud Engineering
  • SAP Services
  • Careers
  • Success Stories

© 2023 Kellton