List of client-side (javascript) events

Every now and then, I find myself asking which client-side event I should hook into for my javascript functions. And every time I check for a list of these events that are available to hook into, I can’t find a complete list.

Is there such a list somewhere?

1 Like

What I can glean from my learning survey -

The user frappe runs asyncio_posix.py that I figure is the event loop process that directs the event and callback mechanism.

For DocType Events the only list I have seen are documented here

https://frappe.io/docs/user/en/tutorial/controllers
Executing Code On Doctype Events

Apart from that there’s the code itself where events have say on_, before_ or after_* that give clues to when and what action event they answer to

frappe and erpnext have a hooks.py that list events but these are not limited to client-side javascript events that you seek

edit: here are some code examples that lists triggers

This documents events from a hooks view https://frappe.io/docs/user/en/guides/basics/hooks

4 Likes

Thanks. I guess this is the best reference for now.

Can attach to standard doctype events using custom_<event_name> as shown in example above.

Have seen these events scattered in code… frappe and erpnext

refresh
onload_post_render
before_load
onload
validate

Can see these events triggered in form.js

before_save
before_submit
on_submit
after_save
before_cancel
after_cancel
3 Likes

For additional reference, note also this Server Script DocType feature introduced in V12…!

A Server Script lets you dynamically define a Python Script that is executed on the server on a document event or API

Here’s the documentation and the events it supports:

2 Likes

Check the following links:

https://frappe.io/docs/user/en/api/form#form-events

https://frappe.io/docs/user/en/api/#javascript

5 Likes