Forums › Forums › Search & Filter Pro › Get Date Range jQuery
- This topic has 9 replies, 2 voices, and was last updated 8 years, 9 months ago by Ross.
-
Ross Moderator(Private) January 21, 2016 at 5:57 pm #34952
You can find what the user has selected via PHP:
http://www.designsandcode.com/documentation/search-filter-pro/accessing-search-data/
Alternatively you would just do some check on the field itself:
$('.sf-datepicker').val()
Notice, this selector
.sf-datepicker
will match multiple elements so you will likely need to change this code somewhat to account for the different field, or change the selector.Anyway, S&F uses the standard
.datepicker()
from the jQuery UI, so it should work fine if that is what you are trying to use.Thanks
Ross Moderator(Private) January 22, 2016 at 12:44 pm #34986Ah yeah this is because the html is completely replaced & reloaded.
Check the dev section at the bottom:
http://www.designsandcode.com/33533/search-filter-2-1-released/
There is a new filter for allowing things like this.
Thanks
Anonymous(Private) January 22, 2016 at 1:55 pm #34999Great Thx. One more thing.
I have Search box on my home page. when u click submit it redirect to page with archives (and is work fine). page with archives have same search&filter (and its work fine).But is there option to turn on “Auto submit form” only on page with archives?
Ross Moderator(Private) January 22, 2016 at 5:23 pm #35016Hey Arek
Not at the moment, but you could create a separate search form for your homepage.
In the display method, set it to shortcode – this allows you to input a URL for the results.
Don’t actually place the results shortcode anywhere, just make sure the Results URL is pointing to the archive URL and all should be good 🙂
Thanks
Ross Moderator(Private) January 25, 2016 at 10:32 am #35175Yeah it should take the inputs from the first form, provided you are using the same fields.
Thanks
Anonymous(Private) January 25, 2016 at 2:44 pm #35211Great. Last thing. I’m trying to make validation if Date Field is empty (on home page).
I was trying everything from .datepicker documentation like onSelect on onChange to check is “val” is not empty. But noting work.“val” attribute populating only after submit. Is there any chance to validate range date?.
Ross Moderator(Private) January 25, 2016 at 3:56 pm #35220The val attrtribute always exists, to test if not empty I usualld do
if($('.some-field').val()=="") { alert("empty"); }
-
AuthorPosts