resetData will reset all the form fields.
To reset data for a few fields in the form, you can create an array of fields and then pass that array to a function and set data to null for each field by traversing the array.
This will help you write less code.