I want to run a script for all fields in a doctype. Which event is used for this?

I want to run a script for all fields in a doctype. Which event is used for this?,If any field is changed, run the script.

you can use validate
or, if you want to run a script based on a specific field change, use the get_doc_before_save() method.
like

def solve(self):
    prev_doc=self.get_doc_before_save().field_name
    curr_doc=sel.field_name
   if curr_doc!=prev_doc:
      frappe.msgprint("prev_doc and curr_doc is not same")