How do I set default value in a child field using javascript? So far I have this code does not work as intended. Score is a child doctype. I want to set a default value in the student field. Any ideas?
frappe.ui.form.on("Score", {
onload: function (frm) {
frm.set_value("student", "Testing");
},
});
@rmehta Thanks! but I do not know how to access the child field student?
frappe.ui.form.on("Grade Sheet", "score_on_form_rendered", function (doc, grid_row) {
console.log("im here");
doc.set_value("student", "Testing"); <--- error student field not found
})
Grade Sheet is the parent table and score is the field name Table type thats points to Score doctype. How can I access the field student that belogs to Score Child Doctype?
@rmehta My solution did not work. It will set the the text box in the UI but when I click done the student value will be the first record in the query(dropdown) not the value set in the text box. Any idea how to resolve this?