Dynamically modify a form field property in frappe
A quick tip on how to dynamically modify a frappe property, like the description of a field, for displaying dynamic information
·
1 min read
If you ever need to provide dynamic updates to a form field in the frappe framework, here's how you do it.
Let's say we want to give the user a dynamic update on the length of the string in a text box. In a client-side javascript event function we could write:
frm.set_df_property("text", "description", `${frm.doc.text.length}/280`);frm.refresh_field("text");// optional:frm.trigger("run_some_other_function");
Where text is the field name, description is the property and ${frm.doc.text.length}/280 is the content you want to assign to the property.
No comments yet. Login to start a new discussion Start a new discussion