Support Forums

The forums are closed and will be removed when we launch our new site.

Looking for support? You can access the support system via your account.

Forums Forums Search & Filter Pro Empty values for number ranges

Tagged: ,

Viewing 4 posts - 1 through 4 (of 4 total)
  • Nick Sotiriadis
    #267716

    Hello again,

    I had asked a similar question in the past, but I am trying to figure out how to accomplish the following.

    Ideally – at least for my understanding – in cases of range number inputs, the fields should start empty, only with a placeholder – for example prices using as placeholders ‘from’ and ‘to’, and the filter should actually be used only if something is input and use ‘defaults’ 0 and infinity – aka bring all results back if not used. Like a select for example, if you don’t select a value, it simply doesn’t execute. The defaults would be used in case someone for example only inputs a ‘max’ value.

    I can’t really figure out how to mess with the input object of a range input – how do you access any of the values there? I created a filter but it doesn’t change anything. How do you change the default max for example? Some code would be really helpful! (I have successfully manipulated various other kinds of input objects, eg for range selects, but this doesn’t seem to work).

    So, what I am looking for:
    – input range starts with two EMPTY inputs. I would expect if there aren’t any values, then the filter doesn’t execute – this is default behavior – so bring every result back
    – if something is input in both fields, then cool, filter than
    – if someone enters something only on min input, use ‘default max’ a huge number to ‘fake’ infinity
    – if someone enters something only on max input, use ‘default min’ equal to 0

    So I guess the problem starts from the input fields being pre-filled. The back end adds 0 value to both inputs if no value is set, so I guess if the input object can be manipulated to start empty, maybe we have a chance on this.

    Trevor Moderator
    #267764

    The problem, in the current version of our plugin, which will change in V3, is that if a range filter field is used in a form, a submit will always append that to the query values in the URL. If there was a way around this so that, if you didn’t use that filter, it didn’t append, we would have done this already.

    But there isn’t. The alternative is to change the range field to a list of choices that are each individually ranges (Range – Dropdown with single field). These values use the constant step defined in the form, but you CAN change these using the filter you have used before, and there are code examples of that, such as this:

    https://support.searchandfilter.com/forums/topic/prices-change-ranges-to-custom/page/3/#post-258820

    Nick Sotiriadis
    #267766

    Thank you for your reply Trevor, unfortunately, what you suggested is not quite what I am looking for.

    Back to my original question, is there at least a way to manipulate the $inputobject of the range number input field? If so, is there an example? Looks like the input object is split in 3 arrays and am not sure if I am not pointing the values correctly, or if it simply doesn’t work.

    Really, I am looking forward to V3, it’s too bad that there’s no roadmap, and tbh, I am really scared of all the changes that will have to occur. I have written so many custom stuff, hopefully the migration will be easier that I anticipate.

    I know I’ve asked a million times, but maybe this time there’s an estimated release date?

    Trevor Moderator
    #267768

    Hi Nick, there is not, as far as I am aware (and it has been asked many times before) a method to manipulate that input.

    And, as I have said before, no confirmed date.

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

The forum ‘Search & Filter Pro’ is closed to new topics and replies.