<button type="submit" id="customers_filter" onclick="checkWhetherTheTableContainsSearchResults()" class="btn filter-button d-inline-block ml-3"> Filter </button> <input id="search-hidden-input" hidden name="searchValue"> <script> function checkWhetherTheTableContainsSearchResults() { let search = location.search.substring(1) searchInputElement = document.getElementById('search-hidden-input'); if(search != '') { searchInputElement.setAttribute('value', search); } } </script> // If the filter is to work on search results, the original search parameter has to be passed into the request array. // Thus, the request array will return more than one parameter // AND // one of the parameters will be searchValue // WHICH // will contain the entire search parameter (key + value) if ((count($request->all()) > 1) && (isset($request->searchValue))) { if (strpos($request->searchValue, '=')) { $string = $request->searchValue; $array = explode('=', $string); $request->searchValue = $array[1]; } }
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter