default value

Forums › Forums › Search & Filter Pro › default value

Tagged: 

Viewing 4 posts – 1 through 4 (of 4 total)
  • Anonymous
    #58530

    Hi,
    I would put a default value (selected value) during the first display of the search form (in a dropdown and a date), is it possible? how can I do this?
    thank you very much
    Search and filter pro (shortcode method)
    Fred

    Trevor
    #58534

    Using javascript, yes. I assume you only want to do this on initial load (when the form is otherwise empty or unfiltered. You can use the is_filtered function to test for that and then use javascript to set the value of the input. See this thread for the basic usage.

    Anonymous
    #58717

    Hi,
    Thanks ,

    I’m not a developer with JavaScript, but I’ll try.
    I have to test with.:
    global $searchandfilter;
    $sf_current_query = $searchandfilter->get(1726)->current_query();
    if ($sf_current_query->is_filtered()) {
    // do the loop
    } else {
    // initialize data with javascript
    }
    where do I insert the javascript?
    for exemple to set a date with the today’s date (_sfm_my_date)
    Thanks

    Trevor
    #58751

    Nor am I 🙁 I have done some, but not a lot. My guess, for you, you would need something more like:

    global $searchandfilter;
    $sf_current_query = $searchandfilter->get(1726)->current_query();
    if (!$sf_current_query->is_filtered()) {
    // put your javascript here
    }
Viewing 4 posts – 1 through 4 (of 4 total)
Search & Filter Support
Privacy Overview

This website uses cookies so that we can provide you with the best user experience possible. Cookie information is stored in your browser and performs functions such as recognising you when you return to our website and helping our team to understand which sections of the website you find most interesting and useful.

We also use cookies to store items in your cart as well as allowing your to login on the site.

You can adjust all of your cookie settings by navigating the tabs on the left hand side.

By continuing to use this site, you also agree to our Privacy Policy.