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)