Forums Forums Search & Filter Pro align two search forms with executed search

Viewing 5 posts - 1 through 5 (of 5 total)
  • Anonymous
    #30174

    Hi there,

    Really enjoying your plugin so far. With just a few clicks I am almost where I want to be with a much improved search user experience.

    I’m wondering, is it possible to keep the search text in sync across two forms. I’ve tried enabling shortcodes, maintaining state, bookmarkable, native form, but to no avail. Maybe because they are two separate forms, they remember their own value only.

    Here is the situation: I have one simple form with search field in the header that leads to the results page. And on the results page I have another more detailed form with search field and filters in the sidebar. Only the first time when I submit one of the forms, the other one picks it up on the results page. But after that they stick to what you’ve entered. It doesn’t updated the other one. I was hoping either form could pick up the executed search, instead of remembering their old value.

    Is this possible at all? I hope I’m explaining myself clearly.

    Thanks for your advice,

    Bram

    Ross Moderator
    #30176

    Hey Bram

    Are you using ajax? In this case I’m afraid not.

    What you would need to is write some jQuery code, to detect when

    .searchandfilter input[type=text] is updated, and when it is, copy the val of that to all other instances on the page.

    Alternatively, if you have bookmarkable URLs enabled, and Ajax disabled, then they will use the same URL variable to populate the search field.

    Thanks

    Anonymous
    #30177

    Hi Ross,

    Thanks for the fast reply.

    Yes, AJAX is what we need. Good to know I’m not overlooking something.
    And thanks for pointing in the right direction. I’ll see if I can get it to work that way.

    Have a nice day!

    Bram

    Anonymous
    #30322

    I came up with this little snippet that works quite good for now.

    $( "body" ).on( "change", ".searchandfilter input[type=text]", function() {
       $('.searchandfilter input[type=text]').val( $( this ).val() );
    });

    The ‘change’ event only fires on blur, but fortunately your plugin blurs the search field when submitting the form through ajax so that works well.

    Ross Moderator
    #30550

    Thanks for the update Bram!

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