AutoFormCreate vue pre populating with model

Hi is it possible to pre populate the fields for an AutoCreateForm? I’ve tried using v-model but it doesn’t display or submit

const createUser = ref<CreateUser>(new CreateUser({note: "SOME TEXT"}));
      <AutoCreateForm
          v-model="createUser"
          form-style="card" type="CreateUser"
      />

Am I going about it the correct way? If not can you please point me to an example of an AutoCreateForm being pre populated?

Thanks

Just seen the configure-field property for AutoCreateForm, is this the intended way to supply default field values?

It’s only bound to an empty DTO, but you should be able to pragmatically update its dto with its exposed setModel API:

Include ref to component:

<AutoCreateForm ref="refForm" form-style="card" type="CreateUser" />

You can use setModel to update it:

const refForm = ref()
onMounted(() => {
    refForm.value?.setModel({note: "SOME TEXT"})
})
1 Like