mirror of
https://github.com/frappe/frappe.git
synced 2026-04-24 01:14:06 -06:00
Page:
(Client Side Scripting)Fetching child tables
Pages
(Client Side Scripting)Fetch values from another document
(Client Side Scripting)Fetching child tables
App Development using GitHub
Client Side Scripting Index
Client side scripting(Archive)
Client side scripting
Deprecations
Developer Cheatsheet
Frappe Framework Front End Routing and Document Creation
Frappe Push Notification Client Reference
Frappe Test Record Loading: Startup Sequence
Generating Test Records in Frappe
Home
Installing Frappe ERPNext on MacOS
Migrating to Version 13
Migrating to Version 14
Migrating to nightly version
Migrating to version 15
Migrating to version 16
Pull Request Review Guidelines
Setup MariaDB Server
Setup NFS Server
The Hitchhiker's Guide to Installing Frappe on Linux
The Hitchhiker's Guide to Installing Frappe on Mac OS X
Tree view for custom DocType
Using Desk Modules, Calendar and List View in Frappe Framework
Using Frappe with Amazon RDS (or any other DBaaS)
Using the VSCode Debugger with Frappe
Writing an IntegrationTestCase in Frappe: A Step‐by‐Step Guide
query builder migration
No results
This is part of a series on Client Side Scripting. Click here to return to the Index
The following function will allow you to copy the values from a child table and paste them into another.
frappe.ui.form.on("[TARGETDOCTYPE]", {
"[TRIGGER]": function(frm) {
frappe.model.with_doc("[SOURCEDOCTYPE]", frm.doc.[TRIGGER], function() {
var tabletransfer= frappe.model.get_doc("[SOURCEDOCTYPE]", frm.doc.[TRIGGER])
$.each(tabletransfer.[SOURCECHILDTABLE], function(index, row){
var d = frm.add_child("[TARGETCHILDTABLE]");
d.[TARGETFIELD1] = row.[SOURCEFIELD1];
d.[TARGETFIELD2] = row.[SOURCEFIELD2];
frm.refresh_field("[TARGETCHILDTABLE]");
});
});
}
});
- [TARGETDOCTYPE] - The doctype that is being worked in.
- [TARGETCHILDTABLE] - The table to be populated. This value is the name of the table field in the parent doctype. *[TARGETFIELD] - The field name in the target child table.
- [SOURCEDOCTYPE] - The doctype that contains the information to be pulled
- [SOURCECHILDTABLE] - The table to pull information from. This value is the name of the table field in the parent doctype. *[SOURCEFIELD] - The field name to pull data from within the table.
- [TRIGGER] - What causes the function to activate.