Forums Forums Search & Filter Pro Get Date Range jQuery

Viewing 10 posts - 1 through 10 (of 10 total)
  • Anonymous
    #34937

    Hello,
    I have a date range (two inputs).
    I need to get those input values and check them if they are less then 30days.

    (#x).datapicker functions don’t work

    Pls Help
    thx

    Ross Moderator
    #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

    Anonymous
    #34982

    Is there any option instead of using jquery to add different class for range date inputs?

    Now Two inputs have same ‘class’ and ‘name’. When I add Class with jquery they are removed after ajax reload.

    Ross Moderator
    #34986

    Ah 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
    #34999

    Great 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
    #35016

    Hey 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

    Anonymous
    #35174

    In this case after redirect second search form (on archive page) will remember inputs from 1st (home page) form?

    Ross Moderator
    #35175

    Yeah it should take the inputs from the first form, provided you are using the same fields.

    Thanks

    Anonymous
    #35211

    Great. 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
    #35220

    The val attrtribute always exists, to test if not empty I usualld do

    if($('.some-field').val()=="")
    {
        alert("empty");
    }
Viewing 10 posts - 1 through 10 (of 10 total)