How to set property of field in child table?
Ans: We can set property of doc fields using following syntax.
e.g.
We can also set property of fields in child table, which is the main reason for this post.
Syntax:
e.g.
Using above code, we have generated dynamic dropdown in child table field of Select type.
Ans: We can set property of doc fields using following syntax.
cur_frm.set_df_property(FIELDNAME, Property, Value);
e.g.
cur_frm.set_df_property("cheque_no", "reqd", doc.voucher_type=="Bank Entry");
We can also set property of fields in child table, which is the main reason for this post.
Syntax:
var df = frappe.meta.get_docfield("TABLE NAME","FIELDNAME", cur_frm.doc.name);
df.read_only = 1;
e.g.
var df = frappe.meta.get_docfield("Employer Project Details","company_name", cur_frm.doc.name);
df.options = ["Tech M", "Wipro", "TCS"];
Using above code, we have generated dynamic dropdown in child table field of Select type.
Please comment if you like this post or need any help.
Thanks,
Sambhaji Kolate
wow...this is great...Exactly what i was looking for...Besides READ ONLY, what other properties can we set this way?
ReplyDelete@Ruben Thanks for your comment.
ReplyDeleteYou can property mentioned in Customize form, like hide, make collapsible, set options for Select field, read_only or mandatory etc
great...thanks :)
ReplyDeletegreat job
ReplyDeleteThank you.
ReplyDelete