frappe icon indicating copy to clipboard operation
frappe copied to clipboard

Allow users to tap into the dirty event for a form.

Open Abhirup-99 opened this issue 2 years ago • 5 comments

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.

Abhirup-99 avatar Jul 04 '22 16:07 Abhirup-99

Would a PR be accepted for this?

Abhirup-99 avatar Jul 04 '22 16:07 Abhirup-99

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

ankush avatar Jul 05 '22 10:07 ankush

Hi, yes. Listening to whether the form is dirty or not.

Abhirup-99 avatar Jul 05 '22 10:07 Abhirup-99

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 avatar Aug 10 '22 05:08 rtdany10

@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.

ankush avatar Aug 10 '22 05:08 ankush