Fields are not getting load properly show when reload

Sometimes, the fields in a child table do not load properly when the show/hide functionality is applied based on the selected category and subcategory. These fields should only be displayed when their related category and subcategory are selected. However, sometimes they do not appear correctly and require a page refresh to function properly. Urgent assistance is needed.


Hi @Vishal_Rajput,

Please check it.

I hope this help.
Thank You!

Dear Nihantra Please read my question carefully because it wasn’t about an issue with assets loading; rather, it was about child tables that wouldn’t load correctly when their connected category and sub category were chosen. I’ve included a small piece of code for your reference.

function hide_all_subcategory_attribute_fields(frm, cdt, cdn) {
	var subcategory_attribute_fields = ['Gold Target', 'Diamond Target', 
	'Metal Colour', 'Product Size', 'Length', 'Height', 'Sizer Type', 
	'Enamal', 'Rhodium', 'Stone Type', 'Gemstone Type', 'Gemstone Quality',
	'Stone Changeable', 'Changeable', 'Hinges', 'Back Belt', 'Vanki Type',
	'Black Beed', 'Black Beed Line', 'Screw Type', 'Hook Type', 'Lock Type',
	'2 in 1', 'Kadi Type', 'Chain', 'Chain Type', 'Customer Chain', 'Chain Length',
	'Total Length', 'Chain Weight', 'Detachable', 'Back Chain', 'Back Chain Size',
	'Back Side Size', 'Chain Thickness', 'Total Mugappu', 'Kadi to Mugappu',
	'Space between Mugappu', 'Nakshi', 'Nakshi From', 'Customer Sample',
	'Certificate Place', 'Breadth', 'Width', 'Back Belt', 'Back Belt Length'];
	show_hide_fields(frm, cdt, cdn, subcategory_attribute_fields, 1);
}

The function hide_all_subcategory_attribute_fields hides specific fields in a form. It works by defining a list of field names (attributes) related to product subcategories and then calling another function show_hide_fields to hide these fields.

Here’s a breakdown of what the function does:

  • Function Name: hide_all_subcategory_attribute_fields
    • The function name indicates that its purpose is to hide all fields related to subcategory attributes.
  • Parameters:
    • frm: Refers to the form object where the fields are located.
    • cdt: Refers to the “Child DocType” (which typically means a related form or document type in systems like ERPNext).
    • cdn: Refers to the “Child Document Name” (which could be a specific instance of the child document or form).
  • Field List:
    • subcategory_attribute_fields is an array containing the names of various attributes related to a subcategory, such as Gold Target, **[Diamond](https://rashiratanjaipur.net/gemstones/diamond)** Target, Metal Colour, etc. These are the fields that will be hidden.
  • Calling show_hide_fields:
    • This function (show_hide_fields) is presumably responsible for either showing or hiding the specified fields.
    • The parameters passed to it are:
      • frm: The form object.
      • cdt and cdn: Likely related to document types and specific instances of the document.
      • subcategory_attribute_fields: The list of fields to be hidden.
      • 1: Likely represents the action to be taken, where 1 might mean “hide” the fields.

The function effectively hides all the fields in the subcategory_attribute_fields list when executed.