Child doctype - set required field

Hi,

Requirement:: Set required true to only opened child doctype

Issue::

  1. We have manage to set the required true option for child field.
  2. Required option is getting enable for each child doctype

Screenshot::

  1. If isActive is false then show the textarea and make it mandatory.
  • textarea is getting hide/show based on isActive flag – Success
  • set filed mandatory - success
  • The filed is getting mandatory for all the child doctype – failed

Code::

var field = frappe.utils.filter_dict(cur_frm.fields_dict["child_doctype_name"].grid.grid_rows_by_docname[cdn].docfields, {"fieldname": "field_name"})[0];
field.reqd = 1;

Reference link:: Enable or Disable a Child Table Field - #17 by ruchin78

Anyone can explain the working of “eval:doc.field_name” for Child doctype will be helpful.

Based on this knowledge I can try to complete my query.

Hi, The above scenario is quite impossible to achieve.

We have done workaround - i.e on save button clicked “validate()” help me out.