I'm trying to write a bookmarklet to autofill a form, to simplify manual testing. The site is implemented in React. I've tried using JQuery, for example:
$("#emailAddress").val("[email protected]").changed()
While the input field is visibly updated in the browser, it appears that under the hood the field is not recognised as changed, as validation fails on form submit, saying the data is missing.
Is there a workable way to autopopulate the React form fields using ad-hoc JS, without changing any of the source code?
(Note: I understand that this sort of direct manipulation is not the correct way to work with React in general app development. Here, I'm looking for any solution, no matter how hacky, to simplify ad-hoc manual testing).
onChangehandler to each input field, where each change event will send the new value of the field to some centralized store, which will cause the React component to re-render with the new value present.onChangemechanism as you describe. Any ideas on how to generate an appropriate change event? I've tried as per stackoverflow.com/a/2856602/6524176, but I've not had any luck.