This website uses cookies to personalize your experience. By using this website you agree to our cookie policy.

Multiple custom fields only showing one result

Home Forums Product Support Forums Ajax Search Pro for WordPress Support Multiple custom fields only showing one result

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #36791
    samgardinersamgardiner
    Participant

    The website is an Art competition and you can submit as many entries as you like via a form which then maps the fields into a CPT named Artwork

    On the front end you can search the custom fields, Name, Artwork, category etc in dropdowns.

    The issue is for example, a girl named Violet Bentley has 4 entries/posts in the Artwork CPT but when you search her name, only one entry appears instead of all 4.

    The values are being brought into the dropdown with the get_values variable.

    The site is live but I’ve given you dev site details

    Thanks

    #36803
    Ernest MarcinkoErnest Marcinko
    Keymaster

    Hi!

    Thank you for the details, it helps a lot!

    I am not entirely sure, but there seems to be an empty space after the name in the following post: https://australia-ain.eblue-hosting.co.uk/wp-admin/post.php?post=803&action=edit
    Looks like that is applied to the filter, and only this item is returned. Can you try removing the space character after the “Violet Bentley” name (and then reloading the search on the front-end), to see if that helps?

    #36804
    samgardinersamgardiner
    Participant

    Yes that worked! You’re a genius.

    Going forward, I’m presuming that the space is the result of autocomplete when they fill out the form.

    I think this should solve the issue going forward. Thank you very much, life saver.

    $(‘form’).on(‘blur’, ‘input[type=”text”], textarea’, function() {
    $(this).val((i, value) => value.trim());
    });

    #36805
    samgardinersamgardiner
    Participant

    Sorry, I tried adding the class of the span to it but it hasn’t worked.

    $(‘form’).on(‘blur’, ‘input[type=”text”], textarea, .asp_select2-selection__rendered’, function() {
    $(this).val((i, value) => value.trim());

    What am I missing?

    #36807
    samgardinersamgardiner
    Participant

    Ignore the last question.. Thanks

Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.