# CMS Filter not detecting input field values added by custom code

**URL:** https://forum.finsweet.com/t/cms-filter-not-detecting-input-field-values-added-by-custom-code/2450
**Category:** General
**Created:** [January 31, 2024, 8:11am UTC](https://forum.finsweet.com/t/cms-filter-not-detecting-input-field-values-added-by-custom-code/2450 "2024-01-31T08:11:05Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![shane.topping](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.finsweet.com/shane.topping/32/282_2.png) [@shane.topping](https://forum.finsweet.com/u/shane.topping)
#### Post date: [January 31, 2024, 8:11am UTC](https://forum.finsweet.com/t/cms-filter-not-detecting-input-field-values-added-by-custom-code/2450/1 "2024-01-31T08:11:05Z")

</div>

Hi team,  
I have custom code (see below) that inserts text values into input fields which are used for filtering with CMS Filter with From/To ranges.  
Manually entering the text values into the input fields filters fine, however adding the same text values via my code does not filter. Note that a button is used to trigger the filter after the text values are inputted. Any help would be appreciated!

```auto
<script>
$('#priceFrom').on('change',function(){
    $('#priceFromInput').val($(this).find(":selected").val());
});
$('#priceTo').on('change',function(){
    $('#priceToInput').val($(this).find(":selected").val());
});
</script>

```

---

<div class="post-metadata">

### Author: ![Support-Luis](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.finsweet.com/support-luis/32/53_2.png) [@Support-Luis](https://forum.finsweet.com/u/Support-Luis)
#### Post date: [January 31, 2024, 10:35am UTC](https://forum.finsweet.com/t/cms-filter-not-detecting-input-field-values-added-by-custom-code/2450/2 "2024-01-31T10:35:18Z")

</div>

Hey @shane.topping! Normally dispatching a new event once the new values are added to the fields solves this issue. Can you try something like this on both inputs?

```js
input1.dispatchEvent(new Event('input', { bubbles: true }));
input2.dispatchEvent(new Event('input', { bubbles: true }));

```

If the issue persists feel free to share a link and I’ll jump in and help 💪
