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.

Accounts

Forum Replies Created

Viewing 4 posts - 1 through 4 (of 4 total)
  • Accounts in reply to:
    Default option on load
    #76423

    I have tried numerous ways to do this without much luck including the function above, a standard jquery function and functions (init & ajax finish) on ajax finish load (as per Q1 here – https://www.designsandcode.com/wordpress-plugins/search-filter-pro/faqs/).

    Ideally I’d love to just set one of the dropdown options as the selected value (either when the page loads or when the other dropdown is clicked – this one I’m setting it on is hidden).

    More than happy to do it via $(“select option[value=’test’]”).attr(“selected”,”selected”);

    I just need to get that working in a place it executes on the page!

    The page with the form is a single-taxonomy.php and has 2 taxonomy dropdown on it (one that the user sees and one that’s hidden that I’d like to set the taxonomy term on). This all works correctly if both dropdown are visible and the user selects the term – so it’s just figuring out how to set the term on the hidden dropdown when the page loads or when the user clicks on the available taxonomy dropdown to them (i’ve tried an on change event without luck).

    Accounts in reply to:
    Default option on load
    #76408

    No when the page loads it just needs that dropdown to be preselected. It’s a taxonomy (so term in the dropdown to be selected). Not creating bookmarkable URLs.

    Accounts in reply to:
    Default option on load
    #76257

    Can’t get it working with that either (using the taxonomy terms in the $query_args?) – do you have a specific example you can point me to that I can take a look at?

    Accounts in reply to:
    Default option on load
    #76187

    Hey Trevor,

    Thank you.

    After numerous other options I tried the below but not sure I’m in the right zone (the custom class is added to the field so it’s partly working).

    I just want to pull one of the options from that dropdown as the default on that page (selected option on page load).

    Any pointers?

    Thank you!

    <?php function filter_input_object($input_object, $sfid) {
    if ($input_object[‘name’] == ‘_sft_testcat’) {
    $input_object[‘defaults’] = array(“Test”);
    $input_object[‘attributes’][‘class’] = ‘mynew_class’;
    }

    return $input_object;

    }
    add_filter(‘sf_input_object_pre’, ‘filter_input_object’, 10, 2); ?>

Viewing 4 posts - 1 through 4 (of 4 total)