frappe
frappe copied to clipboard
Allow users to tap into the dirty event for a form.
Is your feature request related to a problem? Please describe. Currently, there exists no way to listen if a form is dirty or not. This is an important feature available in almost all form libraries in various frameworks like Angular, React, and Vue.
Describe the solution you'd like Allow users to tap into a dirty event which triggers when a form is dirty.
Describe alternatives you've considered No other alternatives are available to this in the current implementation.
Additional context Add any other context or screenshots about the feature request here.
Would a PR be accepted for this?
Do you mean an event when the form first becomes dirty?
https://github.com/frappe/frappe/blob/9a03c535725ea066af5cd4b4f6316d01868876d1/frappe/public/js/frappe/form/form.js#L1237
Hi, yes. Listening to whether the form is dirty or not.
Any update on this? Would love to have an event in Form Script to listen to when the form gets dirty. @Abhirup-99 @ankush
@rtdany10 the one that I linked before doesn't work?
Or do you need one-time trigger only? When form first becomes dirty. In that case you'll have to check for __unsaved
and only trigger it first time. Should be doable easily in dirty()
function.