Bind multiple inputs to one element
See original GitHub issueDescribe the new feature you’d like
I’m trying to create a component that is comprised of:
- an input text field
- a select element
I was thinking of a few ways to achieve it.
Method 1: Custom input
I would build a component similar to FormulateInputText but I’m not exactly sure how I would use v-model
since now I would have an object {inputName: value, selectName, selectValue}
Method 2: wrapper with 2 FormulateInput I could wrap a custom element with:
- my own label
- 2 FormulateInput with no label and no classes (expect for the outer)
<template>
<div>
<mylabel />
<div class="my_wrapper">
<FormulateInput type="text" />
<FormulateInput type="select" />
</div>
</div>
</template>
With the correct classes I could probably achieve the expected outcome this way as well.
Any suggestions?
Issue Analytics
- State:
- Created 3 years ago
- Comments:8 (3 by maintainers)
Top Results From Across the Web
bind multiple inputs to each other in vuejs to change together
If it is your objective to have a single price which is shared by all variants, then I would advise against having a...
Read more >How to Handle Multiple Inputs with a Single onChange ...
Besides handling just one input, a single onChange handler can be set up to handle many different inputs in the form.
Read more >Bindings / Group inputs • Svelte Tutorial
If you have multiple inputs relating to the same value, you can use bind:group along with the value attribute. Radio inputs in the...
Read more >Binding Two input elements together - JavaScript
How can i bind two input fields together so that a given change in one is reflected in the other input field using...
Read more >How to handle multiple inputs in React - DEV Community
Step 2: Handle multiple input change · The goal here is to handle ALL inputs with a single onChange handler · In order...
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 Free
Top 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
@handplant validation rules are passed a
value
property in their context object. That value property would have both values so you could write a validation rule to check both items. Rules are intentionally easy to write:https://vueformulate.com/guide/validation/#custom-validation-rules
Thanks a lot for the feedback. As I played with it over the past few days I realize how Vue-Formulate is powerful! I think as it gets more examples it will be easier for users. Right now I get inspiration from the source files. Great project!