Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Data not saved in web form child table #8932

Open
amutaher opened this issue Nov 18, 2019 · 6 comments
Open

Data not saved in web form child table #8932

amutaher opened this issue Nov 18, 2019 · 6 comments
Assignees

Comments

@amutaher
Copy link

I have a child table in job application webform when an applicant entering data and save it, data in child table not saving in database

@scmmishra
Copy link
Contributor

So far we've not seen this problem of not being able to create child entries. Is there any error on the console??

@scmmishra scmmishra self-assigned this Dec 2, 2019
@scmmishra scmmishra transferred this issue from frappe/erpnext Dec 2, 2019
@ashish-greycube
Copy link
Contributor

there is no error in console. when you try to use standard
http://localhost:8002/desk#Form/Web%20Form/student-applicant
It also doesn't capture child table data
In fact no new row data gets passed on saving the web form.

@amutaher
Copy link
Author

What's new about this issue?

@jay-parikh
Copy link
Contributor

jay-parikh commented Feb 3, 2020

Here is the updated code:
https://github.com/frappe/frappe/blob/version-12/frappe/public/js/frappe/form/grid.js
add_new_row(idx, callback, show, copy_doc) line # 480

if (this.frm) {
	var d = frappe.model.add_child(this.frm.doc, this.df.options, this.df.fieldname, idx);
	if (copy_doc) {
		d = this.duplicate_row(d, copy_doc);
	}
	d.__unedited = true;
	this.frm.script_manager.trigger(this.df.fieldname + "_add", d.doctype, d.name);
	this.refresh();
} else {
	if (!this.df.data) {
		this.df.data = this.get_data() || [];
	}
	var 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);
	this.refresh();
}

@yemikudaisi
Copy link

@AkramMutaher Did you find a fix for these ?

@amutaher
Copy link
Author

Yes, Using This

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants