Data not saved in web form child table

Yes, and this what i received

this Issue not solved yet

Any update for this issue?

Any one can try student applicant web from it’s have child table

Same Problem.Any Help?

same problem on version 12 with newest update. any help?

Same problem faced on Frappe Framework: v12.4.1 (version-12)

Fixed by @youssef

File: /home/frappe123/frappe-bench/apps/frappe/frappe/public/js/frappe/form/grid.js

Diff in code. Maybe somebody can help push it to core frappe.

							${__("Add Multiple")}</button>
		if (!this.df.data){this.df.data = [];}
		this.data = this.get_data();

		// this.remove_all();
				let d = frappe.model.add_child(this.frm.doc, this.df.options, this.df.fieldname, idx);
				let d = { idx: this.df.data.length + 1, __islocal: true, doctype: this.doctype, parentfield: this.df.fieldname, parenttype: frappe.web_form.doctype }
				this.df.data.push(d);
				if(!frappe.web_form.doc.hasOwnProperty(this.df.fieldname)) {
					frappe.web_form.doc[this.df.fieldname] = [];
				}
				frappe.web_form.doc[this.df.fieldname].push(d);

I used the code from here :wink:

You can continue working to apply this pull request.

I have the same problem. I created a webform for subscription doctype which has a child table called plans. The data I enter in the webform is not getting posted in the database. But I dont face any problem with other web forms which has no child tables.

Still have same issue. can you help?

Any idea ?

Is your site running its saying 500 internal server you may check logs on the server like your DB services other services are working or not.Please check Server logs for more details

No site is working correctly and data is saving on database except child table.

@KS_Deal, A workaround is to add a client script and add a validate handler. Then set the property of frappe.web_form.doc[CHILD_TABLE_FIELDNAME] = frappe.web_form.get_values().CHILD_TABLE_FIELDNAME; See the example below where my child table field name is “parameters”:

frappe.web_form.validate = () => {
let data = frappe.web_form.get_values();
frappe.web_form.doc[‘parameters’] = data.parameters;//set this here otherwise the child table values will not save
return true; //Make sure you return true else data will not save
};

1 Like

Thank you, this worked for me.

Just note that the client script should be filled out on the actual web form, not as a custom script.

See the below example on the Job Application Web Form for the child table language.

frappe.web_form.validate = () => {
   let data = frappe.web_form.get_values();
   frappe.web_form.doc['language'] = data.language;
   return true;
};

4 Likes

@alkuhlani

this is the solutions

2 Likes

can plzz snd the js file or code

@Saad_Genirex

Write this script on web Form in Client Script Section

frappe.web_form.validate = () => {
let data = frappe.web_form.get_values();
frappe.web_form.doc[‘Your_Child_Table’] = data.Your_Child_Table;

return true;
};