Forum Replies Created

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • in reply to: Multi-select Enhanced select – disable exact match #35290
    amplastic
    Participant

    i got chatgpt to code it for me 🙂

    jQuery(function ($) {
    function containsAllWords(words, text) {
    for (var i = 0; i < words.length; i++) {
    if (text.toLowerCase().indexOf(words[i].toLowerCase()) === -1) {
    return false;
    }
    }
    return true;
    }

    $(‘.quform-field-multiselect-enhanced’).each(function () {
    var $select = $(this),
    options = $select.data(‘options’),
    config = {
    theme: ‘quform’,
    language: {
    noResults: function () {
    return options.noResultsFound;
    }
    },
    matcher: function(params, data) {
    // If there are no search terms, return all of the data
    if ($.trim(params.term) === ”) {
    return data;
    }

    // Do not display the item if there is no ‘text’ property
    if (typeof data.text === ‘undefined’) {
    return null;
    }

    // params.term should be the term that is used for searching
    // data.text is the text that is displayed for the data object
    var words = params.term.trim().toLowerCase().split(/\s+/);
    if (containsAllWords(words, data.text.toLowerCase())) {
    var modifiedData = $.extend({}, data, true);

    // You can return modified objects from here
    // This includes matching the children how you want in nested data sets
    return modifiedData;
    }

    // Return null if the term should not be displayed
    return null;
    }
    };

    if (Quform.isNonEmptyString(options.placeholder)) {
    config.placeholder = options.placeholder;
    }

    if (options.rtl) {
    config.dir = ‘rtl’;
    }

    $select.select2(‘destroy’).select2(config);
    });
    });

    in reply to: Multi-select Enhanced select – disable exact match #35286
    amplastic
    Participant

    now it displays results it shouldn’t. it seems to be searching for the letters within the words i type? I want it to search for the exact words i type in but doesn’t have to be in the exact order that i type the words in

    • This reply was modified 2 years, 2 months ago by amplastic.
    • This reply was modified 2 years, 2 months ago by amplastic.
    Attachments:
    You must be logged in to view attached files.
    in reply to: “This value is not valid” #35267
    amplastic
    Participant

    nvm i fixed it by disabling “Validate submitted value”

    in reply to: Enhanced Select not working with SSL #35264
    amplastic
    Participant

    I was able to fix this, it had to do with cache

    in reply to: Enhanced Select not working with SSL #35263
    amplastic
    Participant

    chatgpt says

    The reason why the Quform plugin’s “enhanced select” feature only works correctly when viewed with HTTP instead of HTTPS could be due to a security feature in modern web browsers called “Mixed Content Blocking”.

    Mixed Content occurs when a webpage served over HTTPS contains resources (such as scripts, images, or stylesheets) that are loaded over an unencrypted HTTP connection. Modern web browsers block these resources by default to protect users from security vulnerabilities, which can lead to the feature not working correctly.

    It’s possible that the Quform plugin’s “enhanced select” feature uses some resources (such as images, stylesheets, or scripts) that are loaded over an unencrypted HTTP connection. When the webpage is served over HTTPS, the browser may be blocking these resources, which is causing the issue.

    To resolve this issue, you should make sure that all resources used by the Quform plugin’s “enhanced select” feature are loaded over an encrypted HTTPS connection. You can check the browser console for errors and warnings related to mixed content to help identify the resources causing the issue. Once you’ve identified the resources causing the issue, update their URLs to use HTTPS instead of HTTP. This should ensure that the feature works correctly even when viewed with HTTPS.

    in reply to: Product Field #35250
    amplastic
    Participant

    nvm i got chatGPT to write it for me

    /* pull product data for claims form */
    add_action(‘quform_pre_display_1’, function (Quform_Form $form) {
    $element = $form->getElement(‘quform_1_17’);

    if ($element instanceof Quform_Element_Multi) {
    $options = array();
    $args = array(
    ‘posts_per_page’ => -1,
    ‘post_type’ => ‘product’,
    ‘tax_query’ => array(
    array(
    ‘taxonomy’ => ‘product_visibility’,
    ‘field’ => ‘name’,
    ‘terms’ => ‘exclude-from-catalog’,
    ‘operator’ => ‘NOT IN’,
    ),
    ),
    );

    $query = new WP_Query($args);

    if ($query->have_posts()) {
    while ($query->have_posts()) {
    $query->the_post();
    $product = wc_get_product(get_the_ID());
    if ($product) {
    $sku = $product->get_sku() ? ‘ (‘ . $product->get_sku() . ‘)’ : ”;
    $options[] = array(‘label’ => get_the_title() . $sku, ‘value’ => get_the_title() . $sku, ‘id’ => get_the_ID());
    }
    }
    wp_reset_postdata();
    }

    $element->setOptions($options);
    }
    });

Viewing 6 posts - 1 through 6 (of 6 total)
Be inspired. © 2025 ThemeCatcher Ltd. 20-22 Wenlock Road, London, England, N1 7GU | Company No. 08120384 | Built with React | Privacy Policy