I am writing a module in Drupal 7, that shows some data from database using theme(‘table’).
It works great and now I would like to add some data filtering by a date and a category using
textfield and a select box.
How do I combine those two?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Your theme function returns the formatted output according to an array you pass as a parameter. So you have to filter the contents of your array before passing it to the theme function. Create your form elements using Drupal’s FAPI, in the submit function of your form pass the parameters needed in your page’s query string and use these values to filter/create your array before passing it to your theme function. Usually you use these parameters to filter your SQL query to the database itself.
As an example on how to implement this submission function: How to make a form self referencing in Drupal? Or any other options?
Also, check out Drupal’s core search and dblog modules as references. The reports page in Database Logging has a filter and the Search module implements a search passing parameters.