var dialog = new frappe.ui.Dialog({
title: __("Select a student batch"),
fields: [
{"fieldtype": "Link", "label": __("Please select a Batch to add select students to batch"), "fieldname": "Student Batch",
"reqd": 1, "options":"Student Batch" },
{"fieldtype": "Button", "label": __("Add To Batch"), "fieldname": "add_to_batch"},
{"fieldtype": "Button", "label": __("Add To New Batch"), "fieldname": "update"}
]
});
dialog.show();
i wish to show selected value in the link filed when i click button with label (“Add To Batch”)
i resolved it by myself by using below code
var dialog = new frappe.ui.Dialog({
title: __("Select a student batch"),
fields: [
{"fieldtype": "Link", "label": __("Please select a Batch to add select students to batch"), "fieldname": "student_name",
"reqd": 1, "options":"Student Batch" },
{"fieldtype": "Button", "label": __("Add To Batch"), "fieldname": "update1"},
{"fieldtype": "Button", "label": __("Add To New Batch"), "fieldname": "update"}
]
});
$("[data-fieldname=update1]").on('click',function(){
var batch_name = $("input[data-fieldname='student_name']").val();
selectStudentIdFromStudentDocType(batch_name);
})
dialog.show();
but functions inside dialog called twice
please help me to find what the issue
@makarand_b
@shahid_ecit
try this,
var dialog = new frappe.ui.Dialog({
title: __("Select a student batch"),
fields: [
{"fieldtype": "Link", "label": __("Please select a Batch to add select students to batch"), "fieldname": "student_name",
"reqd": 1, "options":"Student Batch" },
{"fieldtype": "Button", "label": __("Add To Batch"), "fieldname": "update1"},
{"fieldtype": "Button", "label": __("Add To New Batch"), "fieldname": "update"}
]
});
dialog.fields_dict.update1.input.onclick = function() {
var batch_name = $("input[data-fieldname='student_name']").val();
selectStudentIdFromStudentDocType(batch_name);
}
dialog.show();
5 Likes
@Sangram Thanks it is working like ferrari thanks
thank you very much