Comments (6)
Sorry, I forgot to shorten the URL. I updated the initial post
from formkit.
@MattFromGer I'm just seeing the default playground example (just a text input) from the link you FormKit playground link you provided.
from formkit.
This seems counter intuitive at first — but it is working as intended. Actually in Vue Formulate (FormKit’s predecessor) we had it work the way you described and it was a huge issue for users. Most developers use the value
prop to set the initial state of a given input when no value is used. For example, you might use United States
on a registration form as the default value of a country selector if your audience was mostly US based.
However, when a form is repopulated, for example to edit the account details of the same form you want the top-down data to "win" vs the "local" value. This issue is accentuated when you want to encapsulate your form inputs (say into an "Address" component) and reuse it in multiple places, yes you want to have a sensible default on some inputs, but you also don’t want to prop-drill to reach the value
prop on those sub-components.
If you have further questions about this we’d be happy to answer.
from formkit.
Thank you for your answer. It probably makes sense to leave it as it is if most devs are confused otherwise.
Funny thing is, that my use case is indeed the address. I have a delivery address and a billing address. I just pass the data of the backend in the form, check if they're equal and hide one address behind a checkbox. If the user clicks this checkbox to indicate the addresses are deviating, then in my case the new address inputs are populated with the same values. But I wanted to have blank values.
So my workaround right now is, to compare the addresses before passing it to the form. If they are equal, I remove one of the addresses out of the object and only then pass it to the form. Maybe not as straightforward, but a solution I can live with :)
from formkit.
Perhaps you could group your billing/non-billing addresses by wrapping them in a <FormKit type="group" name="shipping_address">
and <FormKit type="group" name="billing_address">
— or for one of them prefix the names of the inputs.
from formkit.
Hm I don't quite understand.. Here's another playground link that makes it more clear I hope.
Edit: Maybe the solution to strip it from the form value instead of handling it at the specific input group is the best solution after all.
from formkit.
Related Issues (20)
- Add `inline` option to Datepicker
- Cannot override some config when using `defaultConfig`
- AutoAnimate doesn't work when used in a repeater or list type of fields
- Dropdown + localStorage plugin + conditional select = strange behavior HOT 3
- Max prop for Dropdown input disables input when max value reached HOT 1
- A11y: removeSelection button has no text. HOT 2
- Add FormKitNode findUpwards() function HOT 3
- Datepicker `week-day-format` prop not working HOT 2
- Autocomplete: listbox accessibility issues HOT 1
- Input text - message slot prop not working HOT 1
- Dropdown family inputs do not scroll when using down arrow key HOT 1
- Submitting invalid multi-step form causes valid inputs to receive a red border HOT 2
- Suffix icon is not keyboard focusable when it has a click handler
- Drag doesn't work on nested repeater HOT 2
- Entry transition not working when floating-label=true HOT 10
- Slider in Multi-step form errors when using v-model HOT 4
- Setup is never called with Options API when using Nuxt HOT 1
- Colorpicker with `value=""` should default to some color HOT 1
- select options not created HOT 1
- Pro: Mask Input - Suffix and prefix is not reative
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from formkit.