Although i write the following code nothing is entering into the child table…
the code snippet…
and it isn’t showing any error …can anyone help me …
Although i write the following code nothing is entering into the child table…
Add console.log()
and debug what parameters are you sending as well as what response you get?
Can you explain what are trying to achieve?
where is detials
field. If this is a field from your parent form then you have to iterate child table entries to set values in every row of the table.
e.g.
frappe.ui.form.on("Registration",{
detials: function(frm) {
$.each(frm.doc.tablefieldname || [], function(i, v) {
frappe.model.set_value(v.doctype, v.name, "email", "xyz@gmail.com")
})
}
})
details is the name of the child table …
you mentioned detials in your code correct it and try again.
sry i can’t understood what you are saying can you please tell me with the help of a code …
thank you
Explain in details what are you trying? On which event you want to fill the field in a table?
After clicking the button at the top i want to fill the table
is there any function like that the cur_frm.set_value
So, after click on verify button, you want to fill table fields.
try this
frappe.ui.form.on("Registration",{
verify: function(frm) {
frappe.call({
method: "frappe.client.get",
args: {
doctype: "User",
filters: {"email":user} //user is current user here
},
callback: function(r) {
$.each(frm.doc.details || [], function(i, v) {
frappe.model.set_value(v.doctype, v.name, "name1", r.message.full_name)
frappe.model.set_value(v.doctype, v.name, "email", r.message.email)
frappe.model.set_value(v.doctype, v.name, "phone", r.message.phone)
})
frm.refresh_field('details');
}
})
}
})
What is Current_User
?
Add console.log in callback and check response
e.g
callback: function(r) {
console.log("response",r.message)
and check this in your browser console
sorry for troubling you again …but i want to modify it little bit the code i just write …
i want to store the different users in the same doctype but because of this code it just duplicating all the values whenever the verify button is clicked
How you solve this problem… pls help me i’m also get this problem
what is your problem exactly ?
he is using a for each function which iterates each row so he will keep getting the same entry in every row. if thats was your question.
Hello, I have had the same error for months and today I have solved sending the array.
cur_frm.set_value(“field_value”, data.message);
Complete code:
frappe.call({
method: "frappe.client.get_list",
args: {
doctype: "Doctype table childs",
fields: ["*"],
filters: [["parent", "=", "name register parent"],],
parent: "Employee"
},
callback: function (data) {
if(data && data.message) {
cur_frm.set_value("education", data.message);
}
}
});
Hi ,
How you solve this problem… pls help me i’m also get this problem
can you show your frappe.client.get method?
frappe.ui.form.on("Registration",{
verify: function(frm) {
frappe.call({
method: "frappe.client.get",
args: {
doctype: "User",
filters: {"email":user} //user is current user here
},
callback: function(r) {
cur_frm.clear_table("details");
for (var i =0; i < r.message.length; i++){
frappe.model.add_child(cur_frm.doc, "Regs Details", "details");
}
$.each(frm.doc.details || [], function(i, v) {
frappe.model.set_value(v.doctype, v.name, "name1", r.message[i].full_name)
frappe.model.set_value(v.doctype, v.name, "email", r.message[i].email)
frappe.model.set_value(v.doctype, v.name, "phone", r.message[i].phone)
})
frm.refresh_field('details');
}
})
}
})