Good Day All
I’m trying to add multiple rows in the Child Table in the Web Form upon loading. The main goal is, once the “Guest” opens the Link of the Web Form to fill the fields, the rows are already added in the Child Table instead of manually adding them.
I reviewed the Documentation page for Customizing Web Forms, but it wasn’t helpful in this case.
https://frappeframework.com/docs/v13/user/en/guides/portal-development/web-forms
The code I tried to emulate for the Web Form:
frappe.ui.form.on('Main Doctype', {
refresh(frm) {
if(frm.doc.__islocal){
var new_row = frm.add_child("table_fieldname");
new_row.fieldname_in_childtable = "Test 1";
frm.refresh_field("table_fieldname");
}
}
});
Into this:
frappe.web_form.on('Main Doctype', {
refresh(frm) {
if(frm.doc.__islocal){
var new_row = frm.add_child("table_fieldname");
new_row.fieldname_in_childtable = "Test 1";
frm.refresh_field("table_fieldname");
}
}
});
I have tried so many different variations of the code based on the Documentation page (Customizing Web Forms), but no luck so far…
Can anyone please help me with the coding ?