A search form is a great way to use URL parameters in a user friendly way. It allows a user to search for specific values in specific fields using plain values and wildcards.
To launch a search form we need to create two separate pages:
- A page containing the search form
- A page containing the data table
The user fills out the search form and presses the submit button. The search form sends values to the data table page. The data table page processes the URL arguments.
Premium features! #
- Premium users can access URL parameters directly in the default where clause.
- This offers a lot more control and fine tuning.
- Premium users can also access URL parameters from http POST requests.
Remove data table search options #
You should remove all other search options from your data table page when you use a search form.
Remove search options from your data table:
- Manually remove search options (see dom options)
OR
- Remove search options using the extention manager (for premium users: much easier)
If you are a premium user and individual column search is enabled for your table, add the following options to advanced options to disable this feature:
Advanced options #
{ "wpda_searchbox": "none" }
Demo #
Template #
You can download a Code Manager template here:
This example contains the search form only and works with both the free and premium version. Please follow the instruction in the template.
Hi. I’m currently developing a search form (not online yet) and the corresponding data table. Is it possible to pre-process the input, that is, after pressing the ‘Search’ button but before opening the data table with the results, to perform some operations on a couple of fields, in order to make them more usable as part of the search condition? I have the Premium version.
The link I provide will be the future home of the database and search form.
Thanks in advance
jpamado
Hi João Paulo,
You can add form validations to your search form using javascript. Here is an example:
https://www.w3schools.com/js/js_validation.asp
You are completely free to implement them in your own way.
As a premium user you can also use the WP Data Access arrays httpGet, httpPost and httpRequest, which allow you to wrap posted values into SQL functions. Please visit the link below for more information:
https://wpdataaccess.com/docs/data-tables-filters/static-filters/
See: Using URL parameters in your default where clause
Hope this helps,
Peter