I have an infopath form web part on my web page along with a CEWP. I'm using javascript in my CEWP to set a field on my Infopath form to some value when a button is clicked. For some reason I can't get the Infopath field to update.
<script type="text/javascript">
function filter()
{ document.getElementById("#ctl00_m_g_01d631bf_e556_4975_acbb_226c880bfd44_FormControl0_V1_I1_E1").Value= "TestValue";
}
</script>
<button onclick="setTimeout(filter,3000);" type="submit">Click</button>
The #ctl00_m_g_01d631bf_e556_4975_acbb_226c880bfd44_FormControl0_V1_I1_E1 is the ID of my text field.