question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Bind multiple inputs to one element

See original GitHub issue

Describe the new feature you’d like

I’m trying to create a component that is comprised of:

  • an input text field
  • a select element

image

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:closed
  • Created 3 years ago
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
justin-schroedercommented, Dec 15, 2020

@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

1reaction
borisdaymacommented, Nov 12, 2020

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!

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found