I'm using the official "webview_flutter" plugin, and I want to modify a form that will be sent to a server. This is the code that I have in my flutter app to programmatically modify form values: (It modifies the value but it sends an empty form to the server)
void _setFormLocationHistory() async {
sleep(Duration(seconds: 1));
await _webViewcontroller.runJavascriptReturningResult(
'var event = new Event("change", {bubbles: true,});var this_input = document.getElementsByName("/awLRwRXn4GTpdcq3aJE2WQ/Location_History")[0];this_input.value = "test";this_input.dispatchEvent(event);');
print("Location History updated in webview.");
}
This is the form that I want to fill programmatically (both from a browser view and from the app view):

However, if I copy and paste the same exact code on my browser console (from pc instead of app), then it gets sent to server correctly. I want the app to work the same way the pc-browser works.
This is the results that I receive in the server. From the app I get an empty string while from browser I get "test2"