Forums Forums Search & Filter Pro Reload JS that modifies form

Viewing 8 posts - 1 through 8 (of 8 total)
  • Anonymous
    #86800

    Hi,

    what s the right JavaScript Event if I want to reload my js file when Auto submit is false, Update the Search Form on user interaction is true and `Load results using Ajax is false’. I can’t seem to get it right.

    I’m inserting one custom li item with JS in form but when I select some value in fields it messes up my fields.

    Thanks

    Trevor
    #86828

    I am not sure you can intercept that event. I have asked Ross before for this and I think he said it is not possible with the current plugin.

    Anonymous
    #86948

    So if I want to change form with JS (add custom li elements and classes) and not use auto submit form than I’m basically out of luck.

    Trevor
    #86974

    I will ask Ross to take a look at the thread.

    Ross Moderator
    #87118

    Hi there

    If you modify the html structure of the form itself (the top level li) then yes, you are out of luck.

    As I’ve mentioned, the next version will support breaking out of the fields, which means you can place them wherever you want and in any html strucutre you desire.

    As for adding classes etc…

    If you have auto count ON, then when you perform a search, the search form is reloaded / fetched again (because the elements inside them can change, and also the count number should be updated).

    This will reset any changes you make, in order to make changes to the form you will either use Javascript to add classes to various elements, and then after an ajax request re-apply that JS (JS events listed here) or you can use one of our filters to edit the classes on the input objects, but from a previous ticket I don’t think that’s what you want.

    As to re-initialising S&F JS.. you can just do:

    $('.searchandfilter').searchAndFilter();

    Thanks

    Anonymous
    #87176

    OK, so I’m thinking creating a custom S&F field for this. Can you point me in the right direction to proper files. For now I found public/include/fields, admin/views/fields, adminavailable-fields-metabox-php, class-search-filter-fields.php.

    Trevor
    #87386

    From what I have read in this post, your requirement is to maintain what your custom js has done to a field control (adding an <li> when the Auto Count -> Update the Search Form on user interaction is true does its stuff (when you change any filter in the form), BEFORE you hit Submit (because, when submit is hit, your js will run again anyway, as you have Ajax off).

    I think that the reply that Ross gave does not see that as a possibility, as he says but from a previous ticket I don’t think that’s what you want.

    Not that I would recommend it, but I *think* that the form elements are built in this file:

    class-search-filter-generate-input.php (in public/includes)

    Ross Moderator
    #87390

    Yup the form elements are there, but thats not the whole “field” as some fields contain multiple form elements (like ranges).

    Again, this is coming in v3, a class you can use to build your own fields.

    The problem with the current version of S&F is thats it poorly decoupled and got bloated.

    Its grown over 3 years, had 1 major refactor, and its due for another.

    You’ll have a very hard time to create your own fields on the fly, and its not something I can easily explain I’m afraid.

    All I can say is, look at the display-shortcode file, which outputs the html of the fields (the function is called get_field), that then relates to the others files you mentioned above (in the fields director), but you’ll have to figure out how so many other classes work, just because of poor decoupling.

    Thanks

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