Depends on Custom Selections with Limited option in dropdown List

Hello
I would like to know if restriction is possible using depends on field.
Example

I have 2 Custom Fields
Type and Class.
Type Select List
1.Top
2.Bottom

Class Select List

  1. Shirt
  2. T-Shirt
  3. Jumper
  4. Jeans
  5. Trouser

If I select Type = Top, Then Class will be visible but only with 3 selection option instead of 5
When I select type= bottom then class will be visible only with 2 (jeans and trouser)

I have done eval:doc.type==‘Top’ but what should be the restriction command to only display the first 3 option like elseif statement.

Just wanted to know if this is possible through gui or else will have to write custom script.

Here based on stability conditions selection, I changed dropdown options in child table.

Parent Doctype = Stability Study Report
Child Doctype = Stability Study Result

frappe.ui.form.on("Stability Study Report", {
	stability_condition: function(frm,cdt,cdn){	
		if(frm.doc.stability_condition == "Accelerated Stability"){
			frappe.meta.get_docfield("Stability Study Result", "month",
		cur_frm.docname).options = "Initial\n1 Month\n2 Months\n3 Months\n6 Months";
			refresh_field("result");
		}
		else{
			frappe.meta.get_docfield("Stability Study Result", "month",
		cur_frm.docname).options = "Initial\n1 Month\n2 Months\n3 Months\n6 Months\n9 Months\n12 Months\n18 Months\n24 Months\n36 Months";
			refresh_field("result");
		}
	}
})
1 Like

Thanks alot.
This gave us the idea.
Got it sorted.