How to get text field value from UI

I have added a custom text field in salary slip doctype. Its for counting the total late days.Means the employees who will come at the office after a particular time are considered to be as late. And there are some other rules and logics i will use to make a result for the salary slip.But the problem is i haven’t found a way how can i get the textfield value from the javascript. i tried to find out from the source code but honestly its very hard to sneak in the code as you followed a new convention i guess and i am not so good Javascript writer as well :cry: Will some one help me to do that. It will be very helpful.


Yes, You can get the text field value from UI. if the new custom text field name is payment_days.
You can access that field value by adding below code into the .js file of that particular doctype.

cur_frm.doc.field_name i.e cur_frm.doc.payment_days

You can keep logs and check the value apparently. I hope you find this useful.

1 Like

If the doctype name is Salary Slip then,

frappe.ui.form.on('Salary Slip','payment_days', function(frm, cdt, cdn) {

Whenever the value gets changed of the field payment_days. It will get you the value and you can perform different operations by using that value.

I’ve kept this for clear understanding. if you got confused by reading the above reply.

1 Like