Hello;
How I can restrict the options of the Select field based on another field?
For example: in the below image, order field is select type and I need to restrict the Buy and Compensate options to appear if the Status is Available and the option Not Allowed if the status is Taken. How?
Regards
Bilal
Write a custom script for on change status event
frappe.ui.form.on("Senior High Spreadsheets", "semester", function(frm) {
//console.log('hello')
frappe.call({
method: "wela.registration.doctype.senior_high_spreadsheets.senior_high_spreadsheets.get_subjects",
args: {
"semester": frm.doc.semester,
"strand": frm.doc.strand
},
callback: function (r) {
console.log('HELLO soy');
console.log(r.message["result"]);
//cur_frm.set_cur_list("grading_subject",r.message["result"]);
…
shahid
July 11, 2018, 7:35pm
3
Try this script in your Parent Doctype,
frappe.ui.form.on("Child Table Name", {
status: function(frm,cdt, cdn){
restrict_order(frm, cdt, cdn);
}
});
var restrict_order = function(frm, cdt, cdn) {
var child = locals[cdt][cdn];
if (child.status == "Available")
{
frappe.model.set_df_property("order", "options", ["Buy", "Compensate"]);
}
else if (child.status == "Taken") {
frappe.model.set_df_property("order", "options", ["Not Allowed"]);
}
}
2 Likes