I have a form for editing a ticket that requires a “Reason for Edit”. What I would like to do is have that automatically filled in as a result of when any of the input fields or the select dropdown changes. I know this can be done with javascript and an onChange event and have it modify (I believe) the innerHTML of the textarea. I’m strong on PHP/MySQL but javascript is definitely my weakness.
What I do not know and have been unsuccessful searching for, is exactly how to code this. As an example of what I have would be the following code:
<!-- Customers name -->
<input type='text' name='customer_name' onChange="updateReason('Updated Customer Name')" /><br><br>
<!-- Customer Email -->
<input type='text' name='customer_email' onChange="updateReason('Updated Customer Email')" />
If either of those two would be changed then the contents of a textarea would be updated and end with a carriage return.
Any help (or even pushed in the right direction / links to a guide) is appreciated.
HTML:
native HTML implementation: