Support Forums

The forums are closed and will be removed when we launch our new site.

Looking for support? You can access the support system via your account.

Forums Forums Search & Filter Pro default value

Tagged: 

Viewing 4 posts - 1 through 4 (of 4 total)
  • Fred Malinge
    #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 Moderator
    #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.

    Fred Malinge
    #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 Moderator
    #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)

The forum ‘Search & Filter Pro’ is closed to new topics and replies.