Skip Navigation

Choosing manual options for custom search filter provokes JS error

Open

Symptoms

When inserting a custom search filter, it is possible to specify a select dropdown for the filter.

If you then select the option “Using manually entered values” the following JS error is thrown:

> Uncaught TypeError: c[e].replace is not a function

This issue was introduced in Blocks 1.6

Workaround

A patch is available.

Download and unzip this file and use it to replace the file of the same name at plugins/wp-views/public/js or plugins/toolset-blocks/public/js

17 thought on Choosing manual options for custom search filter provokes JS error

  • If possible, can you give an estimate of when this will be fixed? I have 2 fields that I would like customers to search on, but I need pulldowns and set manually entered values for them to select. If it is going to be awhile, I could add a “flag” field to my custom posts and use that as a filter, but it is additional work and adding data to each post which will be redundant when this is fixed. So, an ETA would be good for me to help make a decision. Thanks.

    • This is fixed in development, and it will go out with the next round of plugin updates. We are currently finishing up ensuring compatibility with PHP 8, when we will publish a batch of updates at once, and I don’t expect that to take much longer, though I can’t give a precise estimate, I’m afraid. I don’t want to give false expectations but I imagine a week or two.

  • Hi Nigel, thanks so much for your instant reply. That is great news. I will hold off working on a temp solution and wait for the fix to come thru. ( I also look forward to PHP 8 – that caught us out a week ago when we migrated our site to c-panel and we backed down to 7.x.x).
    You all are doing a great job.

    • Work on the development cycle has closed and has moved to testing. I can’t give a specific date, but all being well that shouldn’t take much more than a week or so before we are in a position to release.

  • I wanted to let you know that we published plugin updates today that include a fix for this issue.

    If the updates do not show up on your plugin installer page (click the registered link beneath the plugin name to go to the custom installer page) click the the Check for Updates button to update the list.

    Or you can download the latest versions from your accounts page: https://toolset.com/account/downloads

  • Unfortunately we are havingt to re-open this erratum as it appears there may have been a problem in the build process so that the fix was not included in the latest plugin update. We’ll see if we can remedy that soon.

  • Ahhh, that explains why I’m still seeing it. Please add me to the list of people chomping at the bit to get this fix in production, thanks!

  • Any luck? It’s been about 6 months. Is there something that we can manually hard code until the fix has been pushed?

  • I found an alternate solution for adding custom values. I used the customJs code block on the view to add Javascript that adds the values. Note that for selects where there is a min and max value, but select fields have the same ID but different name values. Here’s my example:

    jQuery(document).ready(function($) {
    let vals = [0,100000,200000,300000,400000,500000,750000,1000000,2000000,3000000,4000000,5000000,10000000,20000000,30000000];

    id1 = jQuery(‘select[name=”wpv-wpcf-listprice_min”]’);
    id2 = jQuery(‘select[name=”wpv-wpcf-listprice_max”]’);

    for(let i=0; i<vals.length; i++) {
    id1.append('$’ + vals[i].toString().replace(/\B(?=(\d{3})+(?!\d))/g, “,”) + ”);
    id2.append(‘$’ + vals[i].toString().replace(/\B(?=(\d{3})+(?!\d))/g, “,”) + ”);
    }
    });

  • Can we get an official fix for this? We’re 6 months in. Apparently my Javascript fix doesn’t work when the filter is configured to show options based on what’s available. As I change other fields, the select list is emptied.

Leave
a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>