We inserted a custom search filter in a view. Type of control = datepicker, comparison = between. This works fine. Now we would like to start with a default min date. Therefore we inserted TODAY() in default date. Unfortunately the timetamp is inserted in both the datepicker for min and the datepicker for max. We only want to te set the Timestamp for the min datepicker. Second issue: In the frontend the timestamp is pre-selected. However, you must click Submit for this filter to be activated (or changing a filter when using ajax refresh on filter change). So we think, there should be an automatic refresh on frontend, when a default date is set. Please see my screenshot for reference. Best regards, Christian.
New threads created by Minesh and linked to this one are listed below:
Hello. Thank you for contacting the Toolset support.
As per our support policy, we entertain only one question per ticket. This will help other users searching on the forum as well as help us to write problem resolution summery for the original issue reported.
Hi Minesh, cool that works! When loading the page, the view reloads automatically and only the start date is set. One last thing: When a user clicks the custom search reset button, both datepickers are pre-selected again. Please see it live here: hidden link So maybe the function could include a second trigger for the reset button? Thank you for your awesome support!!!
What is your custom search settings?
- Full page refresh when clicking Submit
- AJAX refresh when clicking submit
- AJAX refresh when changing any filter
Can you please confirm? I set it to "Full page refresh when clicking Submit".
Our search setting is "AJAX refresh when changing any filter". We also tried "Full page refresh when clicking Submit" with your function. But then users have to click the submit button first.
You will have to compromise a bit here as you have custom requirement. You will have to use the option " Full page refresh when clicking Submit" to see it working.
We set Full page refresh when clicking Submit. But now each time a user clicks on the search button, the second datepicker is cleared. We only want to clear the second datepicker when the view loads initially.
Hi Minesh, we ultimately decided on a different solution. Here's what we've done: We left the default date empty AND we also did not included any jQuery to click the "wpv-date-front-end-clear". We just entered a placeholder in the menu item. With a custom php function (via filter wp_nav_menu_objects) we replace this placeholder with the standard toolset url parameter we needed. Works great. Here's the code: