Frm.get_field('foo').get_value() vs.

Hey. I was wondering … what’s the difference between:



Which variant should usually be used and why the returned values sometimes differ?


1 Like

frm.doc is updated every time a value is changed in the form. This is triggered when the focus is removed from the field.

So if you have a field say Opportunity Amount

When the focus is set out of the field, the frm.doc is updated. However while you’re editing the value in the input, if you want to get the value get_value can be used.

In most cases the frm.doc is sufficiently reliable, say you have events to triggered on setting a certain value, you can always assume frm.doc will be correct.
However say, while the input is being typed, you wish to obtain the value of that field, you can use get_field (it is already passed as a parameter to the on_change function anyway, so you won’t have to use in practice)


  • frm.doc stores “commited” and validated field values from the form
  • get_value returns the current value in the input field