[Feature request] Populate forms with $formkit.load() and only pick schema data
See original GitHub issueDescribe the feature
While we populate forms with the value prop it would also be nice to load API responses directly into <Formkit> and only pick the defined schema values / structure.
The downside of the :value prop is that all values that have been added will be directly transfered as form data when submitting the form (even if they are not in the schema).
With a new $formkit.load
method it will be easy to populate data by e.g. API’s and send only the fields you’ve defined.
onMounted(async () => {
const { data } = await $fetch('/projects')
$formkit.load.load(data)
})
Issue Analytics
- State:
- Created a year ago
- Comments:11 (7 by maintainers)
Top Results From Across the Web
Inputs — Essentials ⚡️ FormKit — Vue Forms, Supercharged
The form type provides a host of features including value collection, initial value setting, form submission, error handling, loading states, and more.
Read more >Custom Inputs — Advanced ⚡️ FormKit
Create your own inputs that automatically inherit FormKit's value-added features such as validation, error messages, data modeling, grouping, labels, ...
Read more >Your first form — Getting-started ⚡️ FormKit
Let's start by creating our first FormKit form! We'll learn some of FormKit's key features and how they benefit you. We'll also pick...
Read more >Build a multi-step form — Guides ⚡️ FormKit
Follow this guide to learn how to build a multi-step form with FormKit. ... Aggregate form data from all the steps into a...
Read more >FormKit ⚡️ Vue Forms — Supercharged
FormKit is a free and open-source comprehensive form development framework for Vue 3. Build industry-leading forms, 10x faster.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Just as also a clarification it is already possible to do what you want with the current API using a plugin. this is a really simple way of doing only to the form level ( also not a plugin ) to just show you that removing fields before setting is possible using
node.input
andnode.hook.commit
( pardon my crude example as it is just an example )I think there is indeed a good point on adding a new function or extending the
node.input
API to do that automatically to improve DX tho.@GustavoFenilli ahaa that’s perfect if we can extend the current api like this:
$formkit.get('nodeId').setMatchingValues(dataObjectFromServer)
.Thanks for the clarification.