Updating the value of a Brazos Input Text control client side

155 views Asked by At

We have a CSHS with a Data Table and Global Filter exposed. After entering a value in the filter and limiting the table, they want to be able to click a button that opens a modal and have it available in an input text in the modal and, by doing so, have it bound to a local variable in the CSHS so it can be used in scripts.

I am able to get the value to show up in the modal (code a bit kludgy but it works) but the input text on the modal doesn’t seem to think it has changed and isn’t binding the value to the variable bound to the input text. Suggestions?

Here’s the code I’m using to get the Global Filter text to display on the modal input text: (added a class name of “searchValue” to the input text in the modal – only one data table on the CSHS so I can use the [0] index of getElementsByClassName)

var el = document.getElementsByClassName('searchValue')[0];
el.getElementsByTagName('Input')[0].value = document.getElementsByClassName("dataTables_filter")[0].firstChild.firstChild.nextSibling.value;
1

There are 1 answers

0
Greg Harley On BEST ANSWER

Try calling the jQuery .change() on the input text field after changing the value. For example:

$("#input_div_1_1_1").val("test").change()