Forums Forums Search & Filter Pro Filter for a value that´s expressed as a fraction

Tagged: , , ,

Viewing 6 posts - 1 through 6 (of 6 total)
  • Anonymous
    #266823

    I´m trying to set-up a search form on custom posts using ACF.

    I have everything figured out except a tiny issue:

    I have a field for which the values are expressed as a fraction in numbers (i.e.: 1/10; 1/20; 1/70; etc.).

    I wanted to include a filter for this in the search form. I chose Number input type, Range – Slider (screenshot here: https://prnt.sc/vl2pn1).

    I´m not able to make it work. The search form filter shows a slider with only one value which is “1”.

    Can you give me some hint please on how I should go about this particular filter?
    Thanks,

    Trevor
    #266856

    Databases do not see fractions, such as those you mention, as numbers. The only valid characters allowed in a database number field are .0123456789 and \ is not allowed. Thus, the values (fractions) are being treated as text. Other than entering the fractions as decimals, I am not aware of a solution that could allow a slider.

    Anonymous
    #266867

    Thank you Trevor. This means, therefore, I cannot filter on this field right? Not even with a different type of filter (other than Slider)?

    Trevor
    #266875

    It will be OK as a Post Meta -> Choice field (and of any sub-type of that).

    Anonymous
    #266904

    Thank you again Trevor.

    Trevor
    #266921

    Thanks for getting back to me. I will close this thread for now.

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