I am trying to set the date value into the child table field...taking the current date and i am adding + 30 days to the current date and i have to set into the childtable...i am geting the child date value from console i have to set it into the child table...
This is the following code:
frappe.ui.form.on(‘Implement Plan’, {
plan_add: function(frm,locals,cdt,cdn){
console.log(locals);
frappe.model.set_value(cdt,cdn,“tcd”,get_today_date(30));
cur_frm.refresh_fields(“tcd”);
}
});
function get_today_date(int) {
var d = new Date();
var result = d.setDate(d.getDate()+int);
console.log(new Date(parseInt(result)));
return new Date(parseInt(result));
};
Hi @rmehta any idea to set value into the childtable (need to get current date and have to add 30 days from the current date and set it to the child table field)
Thanks again,
frappe.ui.form.on(‘Implement Plan’, {
plan_add: function(frm,locals,cdt,cdn){
frappe.model.set_value(cdt,cdn,“tcd”,get_today_date(30));
frm.refresh_field(“tcd”);
}
});
function get_today_date(numb) {
var d = new Date();
var result = d.setDate(d.getDate() + (Number(numb)));
console.log(new Date(parseInt(result)));
return new Date(parseInt(result));
};
Refresh child table name, not field in child table.
What is plan_add? Is it child table name?
Try to bind the field setting to [child_table_name]_on_form_rendered method of child table. So when you open the child table it will set the data field.
plan is the child table name… i tried to trigger the row so i gave plan_add when i add the row it will trigger…i tried what you said [plan]_on_rendered: instead of plan_add: and also i refresh the field with child table name…bt it displays as dashboard in UI…