Jquery UI preventing ajax auto submit?

Forums › Forums › Search & Filter Pro › Jquery UI preventing ajax auto submit?

Tagged: , ,

Viewing 4 posts – 1 through 4 (of 4 total)
  • Anonymous
    #22820

    Hi,

    Firstly I think this plugin is great – and I’ve been through a few.

    I have a little issue and i wonder if you can shed some light. I am trying to run Jquery UI to override the select menus and allow them to be styled better;

    ( ".postform" ).selectmenu();

    It over-rides the styles fine but unfortunately prevents the Ajax auto submit. Using a submit button works fine. Is there something I should be doing to allow this?

    Ross Moderator
    #22822

    I guess doing that replaces the event handlers on the object so you would need to try to recreate the effect of the auto submit.

    So something like

    $(document).on('change', '.searchandfilter select', function(){
    	$('.searchandfilter').submit();
    });

    In the actual S&F autosubmit there is a a setTimeout which gives a small delay before submitting allowing for further user input. If the user interacts with the form any existing timeouts are cancelled, and a new timeout is called with the submit function.

    The next version of S&F has quite a bit of a JS rewrite and there are some easy ways to unload and reload the script associated with with S&F which would probably be what you want to be using after the update – although above advice should still be sound.

    Thanks

    Anonymous
    #22846

    Thank you, that steered me in the right direction.

    Unfortunately it still was;t quite right, and with my limited javascript knowledge, I had to do a little workaround as the page was reloading rather than using Ajax.

    However, by adding a submit button I then hid it using CSS. I then used this script to allow a click function to be performed on it

    $('.searchandfilter select').on('selectmenuchange', function(e) {
    e.preventDefault();
    $('.sf-field-submit input').click();
    });
    

    It works, but it’s a little bit hacky. If you have any more ideas that would be great.

    Looking forward to the new version.

    Thanks.

    Ross Moderator
    #22847

    Cool not sure really, I think its better to wait for hte new version and replace the code above, its almost ready – trying to find a couple of days to finish it off.

    Thanks

Viewing 4 posts – 1 through 4 (of 4 total)
Search & Filter Support
Privacy Overview

This website uses cookies so that we can provide you with the best user experience possible. Cookie information is stored in your browser and performs functions such as recognising you when you return to our website and helping our team to understand which sections of the website you find most interesting and useful.

We also use cookies to store items in your cart as well as allowing your to login on the site.

You can adjust all of your cookie settings by navigating the tabs on the left hand side.

By continuing to use this site, you also agree to our Privacy Policy.