Dependent Select Field

i have two select field named “ABC” and “NUM” both have option "ABC’ have “A” and “B”
and “NUM” have option “1”, “2”, “3”, “4”
now i want make dependent select field like when i select “A” in “ABC” then “NUM” show only “1”, “2”
and like when “B” is selected, “NUM” show only “3”, “4” option

note: i don’t have any child table for this

i tried client script but not working
any solution for this ?

@nilpatel42 try this . Test is my doctype name , anc and num are my fields name . for num you have to set all options in the field’s options (1,2,3 and 4);

frappe.ui.form.on('Test', {
    refresh(frm){
        var value=frm.doc.abc;
	    if (value=="A"){
	         frm.set_df_property("num","options",["1","2"]);
	         frm.set_value("num","1");
	    }
	    if (value=="B"){
	        frm.set_df_property("num","options",["3","4"])
	        frm.set_value("num","3");
	    }
    },
	abc:function(frm){
	   var value=frm.doc.abc;
	    if (value=="A"){
	         frm.set_df_property("num","options",["1","2"]);
	         frm.set_value("num","1");
	    }
	    if (value=="B"){
	        frm.set_df_property("num","options",["3","4"])
	        frm.set_value("num","3");
	    }
	    
	}
})
1 Like