diff --git a/ui/components/Form/Form.vue b/ui/components/Form/Form.vue index 635c9a1d..2d0aabda 100644 --- a/ui/components/Form/Form.vue +++ b/ui/components/Form/Form.vue @@ -28,7 +28,7 @@ import { _ } from 'frappejs/utils'; export default { name: 'Form', - props: ['doctype', 'name'], + props: ['doctype', 'name', 'defaultValues'], components: { FormActions, FormLayout @@ -70,6 +70,13 @@ export default { this.doc.set('name', ''); } + if (this.defaultValues) { + for (let fieldname in this.defaultValues) { + const value = this.defaultValues[fieldname]; + this.doc.set(fieldname, value); + } + } + this.docLoaded = true; } catch(e) { this.notFound = true; diff --git a/ui/components/Form/FormLayout.vue b/ui/components/Form/FormLayout.vue index cfa15176..b7b51290 100644 --- a/ui/components/Form/FormLayout.vue +++ b/ui/components/Form/FormLayout.vue @@ -18,6 +18,7 @@