What is cur_frm class

Hello everyone !

So i am started to learn customize ERPNext, and i stumble to something i didnt understand. At this link :

https://docs.erpnext.com/docs/v13/user/manual/en/customize-erpnext/client-scripts/update-date-field-based-on-value-in-other-date-field

I found a class

cur_frm.cscript.custom_delivery_date

And as i remembered and learn from
Introduction .
Every class from frappe framework starts with “frappe”. so what is this “cur_frm” ?

Hope u can help me, would be better if u put some link for me to learn modifying ERPNext. thanks !

cur_frm is a global variable that represents the active form user is on.

Here is the documentation Form Scripts

1 Like

Hello, thank you for your answer!

But when i read the documentation, the class is “frm” and not “cur_frm”. and I kinda dont know whats that “cscript” class under “cur_frm” too. would be really helpfull if u can help me. Thanks!

I did very little research of cscript it seems this is no longer a practice. Maybe there is still some legacy code using it, but any documentation of it is most likely a few years old.

cur_frm is frm in a global scope. frm is only available in the scope of form event handlers.

Hello, thank you again for your answer!

one more thing, does “cur_frm” still active or is it no longer in practice because i cant see any documentation about it.

and does “cur_frm” have the same child class like “frm” or is it different or have more child class than “frm”? sorry if i am asking too much. i hope you doesn’t mind me asking too much >,< Thanks!

frm and cur_frm are just variables referencing the FrappeForm class. They will have the exact same methods and properties.

My impression (gained from the post below), was that 'cur_frm' wasn’t going to be used anymore.
But perhaps the maintainers changed their minds.

Ahhhh i understand now, its getting clear to me now. Thank you @dj12djdjs and @brian_pond for your help. it is really helpfull. got to learn some more now

I’m pretty glad they didn’t. I find it very helpful to make some quick checks in the browser console while debugging :sweat_smile:

1 Like